channel-worker 2.2.4 → 2.2.5
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.
- package/lib/command-poller.js +11 -1
- package/package.json +1 -1
package/lib/command-poller.js
CHANGED
|
@@ -1323,7 +1323,17 @@ class CommandPoller {
|
|
|
1323
1323
|
const lastActivity = this._profileLastActivity[profileId]
|
|
1324
1324
|
|| (name && this._profileLastActivity[name])
|
|
1325
1325
|
|| 0;
|
|
1326
|
-
|
|
1326
|
+
// If not tracked: check if it has commands — if not, close it (orphaned profile)
|
|
1327
|
+
if (!lastActivity) {
|
|
1328
|
+
try {
|
|
1329
|
+
const cmdCount = name ? await this.api.rendererHasCommands(name) : 0;
|
|
1330
|
+
if (cmdCount > 0) continue; // has work, skip
|
|
1331
|
+
} catch {}
|
|
1332
|
+
// No commands + not tracked = orphaned, close
|
|
1333
|
+
console.log(`[profile-timeout] Closing orphaned profile ${browser.name || profileId} (not tracked, no commands)`);
|
|
1334
|
+
try { await this.nst.stopProfile(profileId); } catch {}
|
|
1335
|
+
continue;
|
|
1336
|
+
}
|
|
1327
1337
|
if ((now - lastActivity) > IDLE_TIMEOUT) {
|
|
1328
1338
|
console.log(`[profile-timeout] Closing idle profile ${browser.name || profileId} (idle ${Math.round((now - lastActivity) / 1000)}s)`);
|
|
1329
1339
|
try {
|