Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(infra): name cancelled relaunches in the orphan import notice

Yudhi Armyndharis033087d8c396
diff --git a/src/modules/infra/infra-data.service.ts b/src/modules/infra/infra-data.service.ts
index 537d147ed..f62c67a1b 100644
--- a/src/modules/infra/infra-data.service.ts
+++ b/src/modules/infra/infra-data.service.ts
@@ -645,12 +645,13 @@ export class InfraDataService {
`(removed from the engine registry; a process restart guarantees cleanup).`,
);
}
- // Engines still mid-initialization (no Map entry yet) are reported in notRunning: their start()
- // self-aborts via the stop mark, but they are not counted as stopped here.
+ // Sessions with no engine yet are reported in notRunning: one still initializing aborts its start()
+ // on the stop mark, and one waiting to relaunch after a failed reconnect had its relaunch cancelled.
+ // Neither is counted as stopped here.
if (result.notRunning.length > 0) {
notices.push(
- `${result.notRunning.length} orphan session(s) had no live engine yet (still initializing): ` +
- `${result.notRunning.join(', ')} — their start() will self-abort.`,
+ `${result.notRunning.length} orphan session(s) had no live engine yet (initializing or waiting to ` +
+ `reconnect): ${result.notRunning.join(', ')}; they will not start.`,
);
}
} else if (orphanedEngines.length > 0 && !data.force) {
diff --git a/src/modules/session/session-engine-controls.ts b/src/modules/session/session-engine-controls.ts
index 65a590f09..d883ea57c 100644
--- a/src/modules/session/session-engine-controls.ts
+++ b/src/modules/session/session-engine-controls.ts
@@ -770,7 +770,9 @@ export class SessionEngineControls {
* 10s deadlines per engine (destroy, then the forceDestroy escalation). The mark + reconnect-cancel happen first so an in-flight reconnect
* cannot resurrect the id while teardown runs. Engines that are mid-initialization (no entry in
* `engines` yet) are marked but cannot be torn down here — their start() will see the stop mark
- * via its existing guard and self-abort; the caller learns about them in `notRunning`.
+ * via its existing guard and self-abort; the caller learns about them in `notRunning`. A session
+ * waiting to relaunch after a failed reconnect has no engine either: the reconnect cancel above is
+ * what stops it, and it is reported in `notRunning` too.
*
* Always resolves. Best-effort: a `failed` entry means destroy and the forceDestroy escalation both
* threw or timed out, and the engine is removed from the Map regardless so it stops holding a