From 2fe36fa4e80f1612732cd4369c00b96049d8a805 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 1 Sep 2026 10:48:20 +0200 Subject: [PATCH] Say once why the hold timer is not unref'd --- src/link-gate.ts | 3 +-- test/session-extras.test.ts | 2 -- todo.md | 5 +++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/link-gate.ts b/src/link-gate.ts index a86e1d0..a6a51b2 100644 --- a/src/link-gate.ts +++ b/src/link-gate.ts @@ -110,8 +110,7 @@ export class LinkGate { settle({ err: aborted() }); } - // Deliberately not unref()'d: a held request is awaited with a destroyed socket and no - // other handle, so an unref'd timer lets the process exit without ever settling it. + // Not unref()'d: a held request is awaited with no other handle, so the process would exit unsettled. if (left > 0) timer = setTimeout(giveUp, left); signal?.addEventListener('abort', onAbort, { once: true }); diff --git a/test/session-extras.test.ts b/test/session-extras.test.ts index 17b23c0..4770767 100644 --- a/test/session-extras.test.ts +++ b/test/session-extras.test.ts @@ -829,8 +829,6 @@ describe('LinkGate', () => { assert.match(held.err?.message ?? '', /did not come back in time/); }); - // A held send is awaited with the socket destroyed, so an unref'd timer here lets a process whose - // only remaining work is that send exit without ever settling it, losing the message silently. test('holds on a timer that keeps the process alive', async () => { const gate = new LinkGate({ log: silentLog, timeout: 10_000 }); const timers = (): number => process.getActiveResourcesInfo().filter(name => name === 'Timeout').length; diff --git a/todo.md b/todo.md index d20940b..52c9db1 100644 --- a/todo.md +++ b/todo.md @@ -139,8 +139,9 @@ session message is a change to every call site. things — `LinkGate.deadline()` and `wait(deadline)` are a two-call protocol whose only failure mode is calling `deadline()` inside the loop, which nothing catches; `Session.linkDown()` is read from both sides of the seam; and `UnansweredError` sits in `pending-requests.ts`, which - never uses it, for the sole edge that makes `send-sms` import that module at all. Every one of these is unpublished, so it is a two-way - door and belongs after 1.0.0. Raised by review, 2026-09-01. + never uses it, for the sole edge that makes `send-sms` import that module at all. Every one of + these is unpublished, so it is a two-way door and belongs after 1.0.0. Raised by review, + 2026-09-01. - [ ] **Does an intermediate delivery notification deserve to be a `dlr`?** `esm_class` message type `INTERMEDIATE_DELIVERY` (0x20) is classified as a message today, so a peer that reports non-final states with it hands the application a raw `id:… stat:ENROUTE` text as an inbound