LCOV - code coverage report
Current view: top level - dashql-app/src/connections - connection_setup_cancellation.ts Coverage Total Hit
Test: DashQL 915828b Lines: 100.0 % 14 14
Test Date: 2026-11-06 19:30:32

            Line data    Source code
       1            1 : const attempts = new Map<string, AbortController>();
       2              : 
       3              : /// Startup and settings share one cancellation owner per database. Cleanup is identity-safe.
       4            1 : export function registerConnectionSetup(connectionId: string, controller: AbortController): () => void {
       5            1 :     const previous = attempts.get(connectionId);
       6            1 :     attempts.set(connectionId, controller);
       7            1 :     if (previous !== controller) previous?.abort(new DOMException('Connection setup replaced', 'AbortError'));
       8            1 :     return () => {
       9            1 :         if (attempts.get(connectionId) === controller) attempts.delete(connectionId);
      10            1 :     };
      11            1 : }
      12              : 
      13            1 : export function cancelConnectionSetup(connectionId: string): void {
      14            1 :     const controller = attempts.get(connectionId);
      15            1 :     attempts.delete(connectionId);
      16            1 :     controller?.abort(new DOMException('Connection setup cancelled', 'AbortError'));
      17            1 : }
        

Generated by: LCOV version 2.0-1