channel-worker 2.5.1 → 2.5.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.
@@ -1438,17 +1438,24 @@ class CommandPoller {
1438
1438
  // two daemons would happily double-launch and corrupt cookies / kill
1439
1439
  // sessions for the underlying Google/FB accounts.
1440
1440
  if (renderer.nst_profile_id && this.api.leaseRenderer) {
1441
+ // api.leaseRenderer returns json.data on success (a {nst_profile_id,
1442
+ // leased_at, lessee} envelope) and THROWS on success=false. So:
1443
+ // - throw → another daemon holds the lease OR API rejected → skip
1444
+ // - return → lease acquired → proceed with NST launch
1445
+ // Previous bug: checked `leaseRes.success !== true` but `.success` is
1446
+ // already stripped from json.data → always falsy → every launch was
1447
+ // wrongfully denied with reason="unknown".
1441
1448
  try {
1442
1449
  const leaseRes = await this.api.leaseRenderer(renderer.nst_profile_id);
1443
- if (!leaseRes || leaseRes.success !== true) {
1444
- const reason = leaseRes && leaseRes.message ? leaseRes.message : 'unknown';
1445
- console.warn(`[scene-dispatch] LEASE DENIED for ${renderer.name || renderer.nst_profile_id}: ${reason} — skipping launch`);
1450
+ if (!leaseRes || !leaseRes.nst_profile_id) {
1451
+ console.warn(`[scene-dispatch] lease returned no data for ${renderer.name || renderer.nst_profile_id} skipping launch (API may be older)`);
1446
1452
  return;
1447
1453
  }
1448
1454
  } catch (e) {
1449
- // Treat lease failure as a soft block the API might be down OR
1450
- // running an older version. Better to skip than risk double-launch.
1451
- console.warn(`[scene-dispatch] lease request failed for ${renderer.name || renderer.nst_profile_id}: ${e.message} — skipping launch`);
1455
+ // Either API said success=false (lease held by peer / unowned /
1456
+ // stale rules failed) OR network failure. Either way, do NOT
1457
+ // launch better idle than collision.
1458
+ console.warn(`[scene-dispatch] LEASE DENIED for ${renderer.name || renderer.nst_profile_id}: ${e.message} — skipping launch`);
1452
1459
  return;
1453
1460
  }
1454
1461
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "2.5.1",
3
+ "version": "2.5.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": {