channel-worker 2.1.0 → 2.1.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/api-client.js CHANGED
@@ -86,6 +86,10 @@ class ApiClient {
86
86
  return this.request('POST', '/workers/scene-dispatch', { nst_profile_id: nstProfileId });
87
87
  }
88
88
 
89
+ async rendererHasCommands(nstProfileId) {
90
+ return this.request('GET', `/workers/renderer-has-commands?nst_profile_id=${encodeURIComponent(nstProfileId)}`);
91
+ }
92
+
89
93
  // Extension download
90
94
  async getExtensionVersion() {
91
95
  const data = await this.request('GET', '/extension-download/version');
@@ -1166,6 +1166,23 @@ class CommandPoller {
1166
1166
  });
1167
1167
  const offlineRenderers = renderers.filter(r => !runningRenderers.includes(r));
1168
1168
 
1169
+ // 5b. Crash recovery — re-launch offline profiles that have assigned commands
1170
+ for (const r of offlineRenderers) {
1171
+ try {
1172
+ const cmdCount = await this.api.rendererHasCommands(r.nst_profile_id);
1173
+ if (cmdCount > 0) {
1174
+ console.log(`[scene-dispatch] Crash recovery: ${r.name} has ${cmdCount} commands but not running — relaunching`);
1175
+ try {
1176
+ await this._launchRendererProfile(r);
1177
+ runningRenderers.push(r);
1178
+ console.log(`[scene-dispatch] ${r.name} recovered`);
1179
+ } catch (err) {
1180
+ console.error(`[scene-dispatch] Failed to recover ${r.name}: ${err.message}`);
1181
+ }
1182
+ }
1183
+ } catch {}
1184
+ }
1185
+
1169
1186
  // 6. Launch profiles up to parallel limit
1170
1187
  console.log(`[scene-dispatch] running=${runningRenderers.length}/${parallelLimit} offline=${offlineRenderers.length} queue=${queueCount} names=[${runningRenderers.map(r=>r.name)}]`);
1171
1188
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
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": {