Skip to content

Commit 128ad20

Browse files
authored
Ignore cache invalidation error from local backend (#2752)
1 parent 994ebff commit 128ad20

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.changeset/lazy-beans-call.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gitbook': patch
3+
---
4+
5+
Ignore cache invalidation error from local backend

packages/gitbook/src/lib/cache/revalidateTags.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,19 @@ export async function revalidateTags(tags: string[]): Promise<{
6060
stats[entry.key].backends[backend.name] = { set: false };
6161
});
6262

63-
await backend.del(unclearedEntries);
63+
try {
64+
await backend.del(unclearedEntries);
65+
} catch (error) {
66+
if (error instanceof Error && error.message === 'Too many subrequests.') {
67+
if (backend.replication === 'local') {
68+
console.warn(
69+
`Too many subrequests, skipping cache del for local backend ${backend.name}`,
70+
);
71+
return;
72+
}
73+
}
74+
throw error;
75+
}
6476
}
6577
}),
6678
);

0 commit comments

Comments
 (0)