File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
packages/workers-shared/asset-worker Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,11 @@ export async function getAssetWithMetadataFromKV(
2323 ) ;
2424
2525 if ( asset . value === null ) {
26- // Don't cache a 404 for a year by re-requesting with a minimum cacheTtl
26+ // Don't cache a 404 for a year by re-requesting with a short cacheTtl
2727 const retriedAsset =
2828 await assetsKVNamespace . getWithMetadata < AssetMetadata > ( assetKey , {
2929 type : "stream" ,
30- cacheTtl : 60 , // Minimum value allowed
30+ cacheTtl : 10 , // Short TTL to handle KV async dual writes
3131 } ) ;
3232
3333 if ( retriedAsset . value !== null && sentry ) {
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ describe("[Asset Worker] Fetching assets from KV", () => {
7878 expect ( spy ) . toHaveBeenCalledTimes ( 2 ) ;
7979 } ) ;
8080
81- it ( "should retry on 404 and cache with 30s ttl" , async ( ) => {
81+ it ( "should retry on 404 with short cache ttl" , async ( ) => {
8282 let attempts = 0 ;
8383 spy . mockImplementation ( ( ) => {
8484 if ( attempts ++ === 0 ) {
You can’t perform that action at this time.
0 commit comments