Skip to content

Commit df1bba3

Browse files
committed
Sync bootstrap code
1 parent fd8e623 commit df1bba3

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/bootstrap/handler.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { RequestMetrics } from "./metrics.ts";
2323
import { Router } from "./router.ts";
2424
import type { Functions } from "./stage_2.ts";
2525
import { ErrorType, PassthroughError, UserError } from "./util/errors.ts";
26-
import { patchCaches } from "./util/patch_globals.ts";
2726
import "./globals/types.ts";
2827

2928
interface HandleRequestOptions {
@@ -150,12 +149,6 @@ export const handleRequest = async (
150149
const cacheAPIToken = getCacheAPIToken(edgeReq);
151150
const cacheAPIURL = getCacheAPIURL(edgeReq);
152151

153-
// TODO: Once the Cache API has been fully rolled out, remove this call and
154-
// let `patchGlobals` handle this.
155-
if (cacheAPIToken && cacheAPIURL) {
156-
patchCaches();
157-
}
158-
159152
let functionNames = functionNamesHeader.split(",");
160153

161154
// We don't want to run the same function multiple times in the same chain,

src/bootstrap/util/patch_globals.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,11 @@ export const patchGlobals = () => {
6868

6969
globalThis.fetch = patchFetchToForwardHeaders(globalThis.fetch);
7070
globalThis.fetch = patchFetchToTrackSubrequests(globalThis.fetch);
71-
};
7271

73-
let hasPatchedCaches = false;
72+
patchCaches();
73+
};
7474

7575
export const patchCaches = () => {
76-
if (hasPatchedCaches) {
77-
return;
78-
}
79-
80-
hasPatchedCaches = true;
81-
8276
if (globalThis.caches) {
8377
// @ts-expect-error This is the only way to set `globalThis.caches`, even
8478
// though it's against the type definition.

0 commit comments

Comments
 (0)