@@ -289,12 +289,9 @@ export async function revalidateIfRequired(
289
289
try {
290
290
const hash = ( str : string ) =>
291
291
crypto . createHash ( "md5" ) . update ( str ) . digest ( "hex" ) ;
292
- const requestId = globalThis . __openNextAls . getStore ( ) ?. requestId ?? "" ;
293
292
294
293
const lastModified =
295
- globalThis . lastModified [ requestId ] > 0
296
- ? globalThis . lastModified [ requestId ]
297
- : "" ;
294
+ globalThis . __openNextAls . getStore ( ) ?. lastModified ?? 0 ;
298
295
299
296
// For some weird cases, lastModified is not set, haven't been able to figure out yet why
300
297
// For those cases we add the etag to the deduplication id, it might help
@@ -321,15 +318,14 @@ export function fixISRHeaders(headers: OutgoingHttpHeaders) {
321
318
"private, no-cache, no-store, max-age=0, must-revalidate" ;
322
319
return ;
323
320
}
324
- const requestId = globalThis . __openNextAls . getStore ( ) ?. requestId ?? "" ;
325
- const _lastModified = globalThis . lastModified [ requestId ] ?? 0 ;
321
+ const _lastModified = globalThis . __openNextAls . getStore ( ) ?. lastModified ?? 0 ;
326
322
if ( headers [ CommonHeaders . NEXT_CACHE ] === "HIT" && _lastModified > 0 ) {
327
323
// calculate age
328
324
const age = Math . round ( ( Date . now ( ) - _lastModified ) / 1000 ) ;
329
325
// extract s-maxage from cache-control
330
326
const regex = / s - m a x a g e = ( \d + ) / ;
331
327
const cacheControl = headers [ CommonHeaders . CACHE_CONTROL ] ;
332
- debug ( "cache-control" , cacheControl , globalThis . lastModified , Date . now ( ) ) ;
328
+ debug ( "cache-control" , cacheControl , _lastModified , Date . now ( ) ) ;
333
329
if ( typeof cacheControl !== "string" ) return ;
334
330
const match = cacheControl . match ( regex ) ;
335
331
const sMaxAge = match ? Number . parseInt ( match [ 1 ] ) : undefined ;
0 commit comments