channel-worker 2.1.1 → 2.1.2

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.
@@ -1137,27 +1137,19 @@ class CommandPoller {
1137
1137
  if (this._dispatching) return;
1138
1138
  this._dispatching = true;
1139
1139
  try {
1140
- // 1. Check if there are queued commands
1141
- const queueCount = await this.api.getSceneQueueCount();
1142
- if (!queueCount) { this._dispatching = false; return; }
1143
-
1144
- // 2. Init Nstbrowser if needed
1140
+ // 1. Init Nstbrowser if needed
1145
1141
  if (!this.nst) {
1146
1142
  const apiKey = await this.api.getSetting('nst_api_key');
1147
1143
  if (apiKey) this.nst = new NstManager(apiKey);
1148
1144
  else { this._dispatching = false; return; }
1149
1145
  }
1150
1146
 
1151
- // 3. Get parallel limit + renderers
1152
- const parallelLimit = parseInt(await this.api.getSetting('veo3_parallel_limit')) || 1;
1147
+ // 2. Get renderers + running browsers
1153
1148
  const renderers = await this.api.getRenderers();
1154
1149
  if (!renderers?.length) { this._dispatching = false; return; }
1155
1150
 
1156
- // 4. Get running browsers from Nstbrowser (source of truth)
1157
1151
  const running = await this.nst.getRunningBrowsers();
1158
1152
  const runningIds = new Set(running.map(b => b.profileId));
1159
-
1160
- // 5. Match renderers to running profiles (by name or UUID)
1161
1153
  const runningByName = {};
1162
1154
  for (const b of running) { if (b.name) runningByName[b.name.toLowerCase()] = b.profileId; }
1163
1155
  const runningRenderers = renderers.filter(r => {
@@ -1166,7 +1158,7 @@ class CommandPoller {
1166
1158
  });
1167
1159
  const offlineRenderers = renderers.filter(r => !runningRenderers.includes(r));
1168
1160
 
1169
- // 5b. Crash recovery — re-launch offline profiles that have assigned commands
1161
+ // 3. Crash recovery — re-launch offline profiles that have assigned commands
1170
1162
  for (const r of offlineRenderers) {
1171
1163
  try {
1172
1164
  const cmdCount = await this.api.rendererHasCommands(r.nst_profile_id);
@@ -1183,7 +1175,12 @@ class CommandPoller {
1183
1175
  } catch {}
1184
1176
  }
1185
1177
 
1186
- // 6. Launch profiles up to parallel limit
1178
+ // 4. Check queued commands
1179
+ const queueCount = await this.api.getSceneQueueCount();
1180
+ if (!queueCount) { this._dispatching = false; return; }
1181
+
1182
+ // 5. Launch new profiles up to parallel limit
1183
+ const parallelLimit = parseInt(await this.api.getSetting('veo3_parallel_limit')) || 1;
1187
1184
  console.log(`[scene-dispatch] running=${runningRenderers.length}/${parallelLimit} offline=${offlineRenderers.length} queue=${queueCount} names=[${runningRenderers.map(r=>r.name)}]`);
1188
1185
 
1189
1186
  const neededLaunches = Math.min(parallelLimit - runningRenderers.length, offlineRenderers.length, queueCount);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
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": {