mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Remove awaiting for local caches to set their values whilst we investigate hanging pages. (#275)
This commit is contained in:
+1
-1
@@ -85,7 +85,7 @@ export async function race<I, R>(
|
||||
const done = () => {
|
||||
resolved = true;
|
||||
if (timeoutId) {
|
||||
clearTimeout(timeoutId!);
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
if (blockTimeoutId) {
|
||||
clearTimeout(blockTimeoutId);
|
||||
|
||||
Vendored
+6
-2
@@ -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)),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user