channel-worker 2.0.0 → 2.0.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.
@@ -1144,25 +1144,20 @@ class CommandPoller {
1144
1144
  const running = await this.nst.getRunningBrowsers();
1145
1145
  const runningIds = new Set(running.map(b => b.profileId));
1146
1146
 
1147
- // 5. Match renderers to running profiles
1147
+ // 5. Match renderers to running profiles (by name or UUID)
1148
+ const runningByName = {};
1149
+ for (const b of running) { if (b.name) runningByName[b.name.toLowerCase()] = b.profileId; }
1148
1150
  const runningRenderers = renderers.filter(r => {
1149
- const profileId = this.nst.isUUID(r.nst_profile_id)
1150
- ? r.nst_profile_id
1151
- : this._resolvedProfiles?.[r.nst_profile_id];
1152
- return profileId && runningIds.has(profileId);
1151
+ if (this.nst.isUUID(r.nst_profile_id) && runningIds.has(r.nst_profile_id)) return true;
1152
+ return !!runningByName[r.nst_profile_id.toLowerCase()];
1153
1153
  });
1154
1154
  const offlineRenderers = renderers.filter(r => !runningRenderers.includes(r));
1155
1155
 
1156
- // 6. Pick target profile
1156
+ // 6. Pick target profile — launch new if under limit, else assign to running
1157
1157
  let target = null;
1158
1158
 
1159
- if (runningRenderers.length > 0) {
1160
- // Assign to a running renderer (round-robin by name for simplicity)
1161
- target = runningRenderers[0]; // TODO: could pick least loaded
1162
- }
1163
-
1164
- if (!target && runningRenderers.length < parallelLimit && offlineRenderers.length > 0) {
1165
- // Under limit — launch a new profile
1159
+ if (runningRenderers.length < parallelLimit && offlineRenderers.length > 0) {
1160
+ // Under limit launch a new profile first
1166
1161
  target = offlineRenderers[0];
1167
1162
  console.log(`[scene-dispatch] Launching ${target.name} (running: ${runningRenderers.length}/${parallelLimit})`);
1168
1163
  try {
@@ -1201,8 +1196,13 @@ class CommandPoller {
1201
1196
  }
1202
1197
  }
1203
1198
 
1199
+ // Fallback: assign to least loaded running renderer
1200
+ if (!target && runningRenderers.length > 0) {
1201
+ target = runningRenderers[0]; // extension processes commands sequentially per profile
1202
+ }
1203
+
1204
1204
  if (!target) {
1205
- // At limit, no running renderers available — wait for next cycle
1205
+ // No renderers available at all — wait for next cycle
1206
1206
  this._dispatching = false;
1207
1207
  return;
1208
1208
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "2.0.0",
3
+ "version": "2.0.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": {