Skip to content

Commit

Permalink
Ignore cache invalidation error from local backend (#2752)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge authored Jan 15, 2025
1 parent 994ebff commit 128ad20
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/lazy-beans-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gitbook': patch
---

Ignore cache invalidation error from local backend
14 changes: 13 additions & 1 deletion packages/gitbook/src/lib/cache/revalidateTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,19 @@ export async function revalidateTags(tags: string[]): Promise<{
stats[entry.key].backends[backend.name] = { set: false };
});

await backend.del(unclearedEntries);
try {
await backend.del(unclearedEntries);
} catch (error) {
if (error instanceof Error && error.message === 'Too many subrequests.') {
if (backend.replication === 'local') {
console.warn(
`Too many subrequests, skipping cache del for local backend ${backend.name}`,
);
return;
}
}
throw error;
}
}
}),
);
Expand Down

0 comments on commit 128ad20

Please sign in to comment.