channel-worker 2.2.2 → 2.2.3
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 +8 -2
- package/package.json +1 -1
package/lib/command-poller.js
CHANGED
|
@@ -1310,12 +1310,18 @@ class CommandPoller {
|
|
|
1310
1310
|
|
|
1311
1311
|
for (const browser of running) {
|
|
1312
1312
|
const profileId = browser.profileId;
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1313
|
+
const name = browser.name?.toLowerCase();
|
|
1314
|
+
// Match by UUID or name (renderers use name as nst_profile_id)
|
|
1315
|
+
const lastActivity = this._profileLastActivity[profileId]
|
|
1316
|
+
|| (name && this._profileLastActivity[name])
|
|
1317
|
+
|| 0;
|
|
1318
|
+
if (!lastActivity) continue; // never tracked — skip (just launched by another process)
|
|
1319
|
+
if ((now - lastActivity) > IDLE_TIMEOUT) {
|
|
1315
1320
|
console.log(`[profile-timeout] Closing idle profile ${browser.name || profileId} (idle ${Math.round((now - lastActivity) / 1000)}s)`);
|
|
1316
1321
|
try {
|
|
1317
1322
|
await this.nst.stopProfile(profileId);
|
|
1318
1323
|
delete this._profileLastActivity[profileId];
|
|
1324
|
+
if (name) delete this._profileLastActivity[name];
|
|
1319
1325
|
} catch (e) {
|
|
1320
1326
|
console.warn(`[profile-timeout] Failed to close ${profileId}: ${e.message}`);
|
|
1321
1327
|
}
|