@infernetprotocol/cli 0.1.54 → 0.1.55

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.
Files changed (2) hide show
  1. package/commands/start.js +18 -2
  2. package/package.json +7 -7
package/commands/start.js CHANGED
@@ -82,6 +82,7 @@ live queries (see \`infernet status\`, \`infernet stats\`, \`infernet logs\`).
82
82
  const DEFAULT_HEARTBEAT_MS = 30_000;
83
83
  const DEFAULT_POLL_MS = 15_000;
84
84
  const UPDATE_CHECK_MS = 5 * 60 * 1000; // 5 minutes
85
+ const UPDATE_DRAIN_MS = 10 * 60 * 1000; // wait for in-flight jobs before restarting
85
86
 
86
87
  async function writePidFile(pid) {
87
88
  const p = getDaemonPidPath();
@@ -189,7 +190,10 @@ async function runDaemon(args, ctx) {
189
190
  lastPollAt: null,
190
191
  pollsOk: 0,
191
192
  pollsFailed: 0,
192
- activeJobIds: new Set()
193
+ activeJobIds: new Set(),
194
+ // Set while a self-update waits for in-flight jobs to finish: the
195
+ // poll loop takes no new jobs, so the restart can happen.
196
+ draining: false
193
197
  };
194
198
 
195
199
  const pidPath = await writePidFile(process.pid);
@@ -513,6 +517,7 @@ async function runDaemon(args, ctx) {
513
517
  stats.pollsOk += 1;
514
518
  return;
515
519
  }
520
+ if (stats.draining) return;
516
521
  try {
517
522
  const result = await client.pollJobs({ limit: 5 });
518
523
  stats.pollsOk += 1;
@@ -1544,6 +1549,8 @@ async function runDaemon(args, ctx) {
1544
1549
  let isUpgrading = false;
1545
1550
  const updateTimer = setInterval(async () => {
1546
1551
  if (shuttingDown || isUpgrading) return;
1552
+ // Never start an upgrade under a running job; the next check retries.
1553
+ if (stats.activeJobIds.size > 0) return;
1547
1554
  const latest = await fetchLatestVersion();
1548
1555
  if (!latest || !isNewerVersion(CURRENT_VERSION, latest)) return;
1549
1556
  isUpgrading = true;
@@ -1568,7 +1575,16 @@ async function runDaemon(args, ctx) {
1568
1575
  process.stderr.write(`[update] post-upgrade setup: ${err?.message ?? err}\n`);
1569
1576
  }
1570
1577
 
1571
- // Release any in-flight jobs before we close ports.
1578
+ // Jobs that arrived while the installer ran get to finish: stop taking
1579
+ // new ones and wait. Restarting under them used to fail every one
1580
+ // ("daemon restarting for self-update", 23 jobs on 2026-09-30).
1581
+ stats.draining = true;
1582
+ const drainUntil = Date.now() + UPDATE_DRAIN_MS;
1583
+ while (stats.activeJobIds.size > 0 && Date.now() < drainUntil) {
1584
+ await new Promise((r) => setTimeout(r, 1000));
1585
+ }
1586
+
1587
+ // Release whatever is still running after the drain window.
1572
1588
  for (const jobId of stats.activeJobIds) {
1573
1589
  try {
1574
1590
  await client.failJob(jobId, 'daemon restarting for self-update');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infernetprotocol/cli",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "description": "GPU-node CLI / daemon for the Infernet Protocol — register a GPU server with a Supabase control plane and start earning.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,12 +30,12 @@
30
30
  "ora": "^9.4.0",
31
31
  "react": "^17.0.2",
32
32
  "react-blessed": "^0.7.2",
33
- "@infernetprotocol/auth": "0.1.54",
34
- "@infernetprotocol/deploy-providers": "0.1.54",
35
- "@infernetprotocol/config": "0.1.54",
36
- "@infernetprotocol/engine": "0.1.54",
37
- "@infernetprotocol/gpu": "0.1.54",
38
- "@infernetprotocol/rpc-adapter": "0.1.54"
33
+ "@infernetprotocol/config": "0.1.55",
34
+ "@infernetprotocol/deploy-providers": "0.1.55",
35
+ "@infernetprotocol/engine": "0.1.55",
36
+ "@infernetprotocol/rpc-adapter": "0.1.55",
37
+ "@infernetprotocol/gpu": "0.1.55",
38
+ "@infernetprotocol/auth": "0.1.55"
39
39
  },
40
40
  "repository": {
41
41
  "type": "git",