mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
fix: resolve updateCache() so race condition does not happen
This commit is contained in:
parent
c62c31a171
commit
b5844ff06e
1 changed files with 1 additions and 1 deletions
|
|
@ -34,7 +34,7 @@ export const cache = (opts: CacheOpts): MiddlewareHandler => {
|
||||||
if (response && expired) {
|
if (response && expired) {
|
||||||
debug('Serving stale cache, rebuilding', c.req.url);
|
debug('Serving stale cache, rebuilding', c.req.url);
|
||||||
const stale = response.clone();
|
const stale = response.clone();
|
||||||
updateCache();
|
await updateCache();
|
||||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||||
return stale;
|
return stale;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue