channel-worker 2.1.5 → 2.1.6

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.
@@ -1190,9 +1190,8 @@ class CommandPoller {
1190
1190
  if (hb && (now - hb) < HEARTBEAT_STALE) continue;
1191
1191
  console.log(`[scene-dispatch] Stuck: ${r.name} running but heartbeat stale (${hb ? Math.round((now - hb) / 1000) + 's' : 'never'}) — restarting`);
1192
1192
  try {
1193
- await this.nst.stopProfile(r.nst_profile_id).catch(() => {});
1194
1193
  await this.api.resetRendererCommands(r.nst_profile_id);
1195
- await this._launchRendererProfile(r);
1194
+ await this._launchRendererProfile(r, { forceRelaunch: true });
1196
1195
  console.log(`[scene-dispatch] ${r.name} restarted`);
1197
1196
  } catch (err) {
1198
1197
  console.error(`[scene-dispatch] Failed to restart ${r.name}: ${err.message}`);
@@ -1245,7 +1244,7 @@ class CommandPoller {
1245
1244
  this._dispatching = false;
1246
1245
  }
1247
1246
 
1248
- async _launchRendererProfile(renderer) {
1247
+ async _launchRendererProfile(renderer, options = {}) {
1249
1248
  await this.nst.ensureProfile(renderer.nst_profile_id, { os: renderer.os || 'windows', proxy: renderer.proxy || null });
1250
1249
 
1251
1250
  const path = require('path');
@@ -1280,7 +1279,7 @@ class CommandPoller {
1280
1279
  console.warn(`[scene-dispatch] Ext dir failed: ${e.message}, using base`);
1281
1280
  }
1282
1281
 
1283
- await this.nst.launchProfile(renderer.nst_profile_id, { proxy: renderer.proxy || null, extensionPath });
1282
+ await this.nst.launchProfile(renderer.nst_profile_id, { proxy: renderer.proxy || null, extensionPath, forceRelaunch: options.forceRelaunch });
1284
1283
  }
1285
1284
 
1286
1285
  // ─── Profile Timeout ───────────────────────────────────────────────────────
@@ -153,8 +153,18 @@ class NstManager {
153
153
  console.log(`[nst] Running browsers: ${running.map(b => b.name || b.profileId).join(', ') || 'none'}`);
154
154
  const isRunning = running.some(b => b.profileId === profileId);
155
155
  if (isRunning) {
156
- console.log(`[nst] Profile ${profileId} already running — skipping launch`);
157
- return { profileId, alreadyRunning: true };
156
+ if (options.forceRelaunch) {
157
+ console.log(`[nst] Profile ${profileId} already running — force stopping for relaunch`);
158
+ try {
159
+ await this.stopProfile(profileId);
160
+ await new Promise(r => setTimeout(r, 3000));
161
+ } catch (e) {
162
+ console.warn(`[nst] Stop failed: ${e.message}`);
163
+ }
164
+ } else {
165
+ console.log(`[nst] Profile ${profileId} already running — skipping launch`);
166
+ return { profileId, alreadyRunning: true };
167
+ }
158
168
  }
159
169
 
160
170
  // Update profile language to en-US (Custom) before launch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "Channel Manager worker daemon — runs on remote machines to execute video pipeline jobs",
5
5
  "main": "lib/daemon.js",
6
6
  "bin": {