Quellcode durchsuchen

fix(multiplexer): add test assertion and race window comment

Michael Henke vor 1 Monat
Ursprung
Commit
a69304ccfe
2 geänderte Dateien mit 3 neuen und 0 gelöschten Zeilen
  1. 2 0
      src/multiplexer/session-manager.ts
  2. 1 0
      src/utils/background-job-coordinator.test.ts

+ 2 - 0
src/multiplexer/session-manager.ts

@@ -623,6 +623,8 @@ export class MultiplexerSessionManager {
   async closeSessionFromCoordinator(sessionId: string): Promise<void> {
   async closeSessionFromCoordinator(sessionId: string): Promise<void> {
     if (!this.enabled) return;
     if (!this.enabled) return;
     // Coordinator already vetted lifecycle policy; skip re-check
     // Coordinator already vetted lifecycle policy; skip re-check
+    // ponytail: theoretical race if new job starts between coordinator's
+    // retryDeferredClose() and this call, but session IDs are unique per launch
     await this.closeSession(sessionId, 'idle', true);
     await this.closeSession(sessionId, 'idle', true);
   }
   }
 
 

+ 1 - 0
src/utils/background-job-coordinator.test.ts

@@ -117,5 +117,6 @@ describe('BackgroundJobCoordinator', () => {
     });
     });
 
 
     expect(listener).toHaveBeenCalledWith('full-chain-test');
     expect(listener).toHaveBeenCalledWith('full-chain-test');
+    expect(listener).toHaveBeenCalledTimes(1);
   });
   });
 });
 });