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.
- package/lib/command-poller.js +13 -6
- package/package.json +1 -1
package/lib/command-poller.js
CHANGED
|
@@ -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.
|
|
1444
|
-
|
|
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
|
-
//
|
|
1450
|
-
//
|
|
1451
|
-
|
|
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
|
}
|