Skip to content

Commit ab83788

Browse files
fix(gateway): wrap aux-handler warn in arrow to preserve log binding
Greptile review feedback on #70676: the previous 'const warn = params.log.warn; logger: { warn }' shape detaches the method from its owning logger, so any implementation that relies on 'this' (or that gets rebound later on params.log) would mis-fire. Replace with an arrow-function wrapper that invokes params.log.warn through its owner each call.
1 parent 1e5dbd4 commit ab83788

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/gateway/server-aux-handlers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ export function createGatewayAuxHandlers(params: {
6262
nextSharedGatewaySessionGeneration,
6363
);
6464
if (previousSharedGatewaySessionGeneration !== nextSharedGatewaySessionGeneration) {
65-
const warn = params.log.warn;
6665
disconnectStaleSharedGatewayAuthClients({
6766
clients: params.clients,
6867
expectedGeneration: nextSharedGatewaySessionGeneration,
69-
logger: warn ? { warn } : undefined,
68+
logger: params.log.warn ? { warn: (m: string) => params.log.warn!(m) } : undefined,
7069
});
7170
}
7271
return { warningCount: prepared.warnings.length };

0 commit comments

Comments
 (0)