channel-worker 2.4.0 → 2.4.1
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 +21 -22
- package/package.json +1 -1
package/lib/command-poller.js
CHANGED
|
@@ -1361,28 +1361,27 @@ class CommandPoller {
|
|
|
1361
1361
|
try {
|
|
1362
1362
|
if (!this.nst) return;
|
|
1363
1363
|
const queue = await this.api.getChatgptQueue().catch(() => null);
|
|
1364
|
-
if (!queue || !queue.
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
const
|
|
1371
|
-
alreadyRunning = running.some(b =>
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
console.error(`[chatgpt-dispatch] Failed to launch ${profileId}: ${err.message}`);
|
|
1364
|
+
if (!queue || !Array.isArray(queue.profiles) || queue.profiles.length === 0) return;
|
|
1365
|
+
|
|
1366
|
+
let running = [];
|
|
1367
|
+
try { running = await this.nst.getRunningBrowsers(); } catch {}
|
|
1368
|
+
|
|
1369
|
+
for (const item of queue.profiles) {
|
|
1370
|
+
const profileId = item.id;
|
|
1371
|
+
const alreadyRunning = running.some(b =>
|
|
1372
|
+
b.profileId === profileId || (b.name && b.name.toLowerCase() === profileId.toLowerCase()));
|
|
1373
|
+
if (alreadyRunning) {
|
|
1374
|
+
this._profileLastActivity[profileId] = Date.now();
|
|
1375
|
+
continue;
|
|
1376
|
+
}
|
|
1377
|
+
console.log(`[chatgpt-dispatch] Launching ${profileId} (pending=${item.pending})`);
|
|
1378
|
+
try {
|
|
1379
|
+
await this._launchRendererProfile({ nst_profile_id: profileId, os: 'windows', proxy: null });
|
|
1380
|
+
this._profileLastActivity[profileId] = Date.now();
|
|
1381
|
+
console.log(`[chatgpt-dispatch] ${profileId} launched`);
|
|
1382
|
+
} catch (err) {
|
|
1383
|
+
console.error(`[chatgpt-dispatch] Failed to launch ${profileId}: ${err.message}`);
|
|
1384
|
+
}
|
|
1386
1385
|
}
|
|
1387
1386
|
} catch (err) {
|
|
1388
1387
|
console.error(`[chatgpt-dispatch] Error: ${err.message}`);
|