channel-worker 2.1.7 → 2.2.0
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 +11 -10
- package/package.json +1 -1
package/lib/command-poller.js
CHANGED
|
@@ -1226,17 +1226,18 @@ class CommandPoller {
|
|
|
1226
1226
|
return;
|
|
1227
1227
|
}
|
|
1228
1228
|
|
|
1229
|
-
// 7. Assign
|
|
1229
|
+
// 7. Assign 1 command per free profile (no pending/running commands)
|
|
1230
1230
|
let assigned = 0;
|
|
1231
|
-
for (
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1231
|
+
for (const r of runningRenderers) {
|
|
1232
|
+
try {
|
|
1233
|
+
const cmdCount = await this.api.rendererHasCommands(r.nst_profile_id);
|
|
1234
|
+
if (cmdCount > 0) continue; // already has work
|
|
1235
|
+
const cmd = await this.api.sceneDispatch(r.nst_profile_id);
|
|
1236
|
+
if (!cmd) break; // queue empty
|
|
1237
|
+
this._profileLastActivity[r.nst_profile_id] = Date.now();
|
|
1238
|
+
assigned++;
|
|
1239
|
+
console.log(`[scene-dispatch] Assigned ${cmd.type} → ${r.name}`);
|
|
1240
|
+
} catch {}
|
|
1240
1241
|
}
|
|
1241
1242
|
} catch (err) {
|
|
1242
1243
|
console.error(`[scene-dispatch] Error: ${err.message}`);
|