Remove awaiting for local caches to set their values whilst we investigate hanging pages. (#275)

This commit is contained in:
Steven H
2024-03-15 13:47:31 +00:00
committed by GitHub
parent 98f91d9e82
commit a4099dff9e
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ export async function race<I, R>(
const done = () => {
resolved = true;
if (timeoutId) {
clearTimeout(timeoutId!);
clearTimeout(timeoutId);
}
if (blockTimeoutId) {
clearTimeout(blockTimeoutId);
+6 -2
View File
@@ -177,12 +177,16 @@ export function cache<Args extends any[], Result>(
// If the resolution came from a fetch (fromBackend is undefined), we don't need to update caches as it was
// done in the revalidate function above.
if (fromBackend?.replication === 'global') {
await waitUntil(
// Write and await to the memory cache, so future requests are guaranteed to hit it.
await memoryCache.set(key, savedEntry);
// Write to other local caches, but don't await (debugging hanging pages)
waitUntil(
Promise.all(
cacheBackends
.filter(
(backend) =>
backend.name !== backendName && backend.replication === 'local',
backend.name !== backendName && backend.name !== memoryCache.name && backend.replication === 'local',
)
.map((backend) => backend.set(key, savedEntry)),
),