@triflux/remote 10.29.0 → 10.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -124,13 +124,18 @@ export function drainPendingSynapse(timeoutMs = 1000) {
124
124
  const settled = Promise.allSettled([...inFlightSynapse]);
125
125
  const ms = Number(timeoutMs);
126
126
  if (!Number.isFinite(ms) || ms <= 0) return settled;
127
- return Promise.race([
128
- settled,
129
- new Promise((resolve) => {
130
- const t = setTimeout(resolve, ms);
131
- if (typeof t.unref === "function") t.unref();
132
- }),
133
- ]);
127
+ let timeout = null;
128
+ const timeoutPromise = new Promise((resolve) => {
129
+ // Keep this timer ref'ed: drainPendingSynapse() is awaited specifically
130
+ // to hold the process open until either in-flight POSTs settle or the
131
+ // bounded drain budget expires. An unref'ed timer can let Node's test
132
+ // runner/process exit before the Promise resolves when no other handles
133
+ // remain.
134
+ timeout = setTimeout(resolve, ms);
135
+ });
136
+ return Promise.race([settled, timeoutPromise]).finally(() => {
137
+ if (timeout) clearTimeout(timeout);
138
+ });
134
139
  }
135
140
 
136
141
  export function registerSynapseSession(meta, opts = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triflux/remote",
3
- "version": "10.29.0",
3
+ "version": "10.30.0",
4
4
  "description": "triflux remote — team mode, psmux, MCP workers, SQLite store.",
5
5
  "type": "module",
6
6
  "main": "hub/index.mjs",