channel-worker 2.4.4 → 2.4.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 +15 -0
- package/package.json +1 -1
package/lib/command-poller.js
CHANGED
|
@@ -1466,6 +1466,21 @@ class CommandPoller {
|
|
|
1466
1466
|
// User-launched profiles have no tracking entry — leave them alone.
|
|
1467
1467
|
if (!lastActivity) continue;
|
|
1468
1468
|
if ((now - lastActivity) > IDLE_TIMEOUT) {
|
|
1469
|
+
// Per-profile in-flight check — getSceneQueueCount only counts
|
|
1470
|
+
// QUEUED cmds, not RUNNING ones. Without this, a profile actively
|
|
1471
|
+
// running a master cast / scene cmd gets closed mid-task because
|
|
1472
|
+
// the queue is empty after the cmd was claimed.
|
|
1473
|
+
let inFlight = 0;
|
|
1474
|
+
try {
|
|
1475
|
+
const probeId = name || profileId;
|
|
1476
|
+
inFlight = await this.api.rendererHasCommands(probeId);
|
|
1477
|
+
} catch {}
|
|
1478
|
+
if (inFlight > 0) {
|
|
1479
|
+
// Bump activity so we re-evaluate after another IDLE_TIMEOUT.
|
|
1480
|
+
this._profileLastActivity[profileId] = now;
|
|
1481
|
+
if (name) this._profileLastActivity[name] = now;
|
|
1482
|
+
continue;
|
|
1483
|
+
}
|
|
1469
1484
|
console.log(`[profile-timeout] Closing idle profile ${browser.name || profileId} (idle ${Math.round((now - lastActivity) / 1000)}s)`);
|
|
1470
1485
|
try {
|
|
1471
1486
|
await this.nst.stopProfile(profileId);
|