Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/await-stale-fallback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@toapi/worker": patch
---

Fix offline stale-fallback in the worker: `serveFromNetwork` is now awaited so the expired-cache catch block can serve the cached response when the network is unavailable.
2 changes: 1 addition & 1 deletion packages/2-toapi-worker/src/handle-toapi-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function handleToapiRequest(
// cached response is expired
try {
// try to serve from network
return serveFromNetwork(req);
return await serveFromNetwork(req);
} catch (error) {
// probably network not available, serve old response
errorLog(error);
Expand Down