From b9f94a6c98489a73702d87b400659c9a50555d70 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Thu, 19 Mar 2026 11:09:27 -0700 Subject: [PATCH] Move setPerfTiming next to perfTiming and always capture request start time Colocate the setter with its variable for readability. Remove the conditional around performance.now() since the call is negligible and simplifies the timing logic. --- src/server/proxy.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/proxy.ts b/src/server/proxy.ts index a05d7fb..b2dd7f0 100644 --- a/src/server/proxy.ts +++ b/src/server/proxy.ts @@ -5,6 +5,8 @@ export type { WsData } export let perfTiming = false +export const setPerfTiming = (on: boolean) => { perfTiming = on } + const pendingMessages = new Map, (string | ArrayBuffer | Uint8Array)[]>() const upstreams = new Map, WebSocket>() @@ -14,8 +16,6 @@ interface WsData { protocols: string[] } -export const setPerfTiming = (on: boolean) => { perfTiming = on } - export function extractSubdomain(host: string): string | null { // Strip port const hostname = host.replace(/:\d+$/, '') @@ -57,7 +57,7 @@ export async function proxySubdomain(subdomain: string, req: Request): Promise