Skip to content

Commit

Permalink
Remove await from user Worker fetch in router-worker (#7410)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalshyDev authored Dec 2, 2024
1 parent 515174e commit 6b21919
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-paws-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/workers-shared": patch
---

chore: remove awaits from Asset Worker fetches. This has no user-facing impact.
4 changes: 2 additions & 2 deletions packages/workers-shared/router-worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ export default {
if (env.CONFIG.has_user_worker) {
if (await env.ASSET_WORKER.unstable_canFetch(request)) {
analytics.setData({ dispatchtype: DISPATCH_TYPE.ASSETS });
return await env.ASSET_WORKER.fetch(maybeSecondRequest);
return env.ASSET_WORKER.fetch(maybeSecondRequest);
} else {
analytics.setData({ dispatchtype: DISPATCH_TYPE.WORKER });
return env.USER_WORKER.fetch(maybeSecondRequest);
}
}

analytics.setData({ dispatchtype: DISPATCH_TYPE.ASSETS });
return await env.ASSET_WORKER.fetch(request);
return env.ASSET_WORKER.fetch(request);
} catch (err) {
if (err instanceof Error) {
analytics.setData({ error: err.message });
Expand Down

0 comments on commit 6b21919

Please sign in to comment.