Skip to content

Commit 940af6a

Browse files
ralyodioclaude
andauthored
fix(worker): infernet.service owns the daemon when enabled; manual update too; v0.2.31 (#47)
- infernet_systemd_managed() also accepts an enabled unit, so a worker restart while infernet.service is mid-restart ("activating") no longer starts a second daemon. - `c0mpute update` skips `infernet update` under infernet.service: it restarted the daemon from the operator's shell beside systemd's. - v0.2.31 (Cargo, JS packages, latest.json fallback). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent df06340 commit 940af6a

8 files changed

Lines changed: 39 additions & 29 deletions

File tree

‎Cargo.lock‎

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ members = [
2323
]
2424

2525
[workspace.package]
26-
version = "0.2.30"
26+
version = "0.2.31"
2727
edition = "2024"
2828
license = "MIT"
2929
repository = "https://github.com/profullstack/c0mpute"

‎apps/tui/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@c0mpute/tui",
3-
"version": "0.2.30",
3+
"version": "0.2.31",
44
"private": true,
55
"type": "module",
66
"bin": {

‎apps/web/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "c0mpute",
3-
"version": "0.2.30",
3+
"version": "0.2.31",
44
"private": true,
55
"type": "module",
66
"scripts": {

‎apps/web/src/app/releases/latest.json/route.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const dynamic = "force-dynamic";
2828
* this in sync with the workspace version in `Cargo.toml` on each release so a
2929
* freshly built CLI reports "already latest" rather than a phantom upgrade.
3030
*/
31-
const FALLBACK_VERSION = "0.2.30";
31+
const FALLBACK_VERSION = "0.2.31";
3232
const FALLBACK_MIN_REQUIRED = "0.0.1";
3333

3434
type Channel = "stable" | "beta" | "nightly";

‎node/crates/c0mpute-cli/src/main.rs‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,6 +2665,12 @@ const PLUGIN_UPDATERS: &[(&str, &[&str])] =
26652665
fn upgrade_plugins_foreground() {
26662666
for (bin, args) in PLUGIN_UPDATERS {
26672667
if let Some(path) = which_on_path(bin) {
2668+
// `infernet update` restarts the daemon from this shell; under infernet.service that
2669+
// starts a second daemon beside systemd's, and the daemon updates itself anyway.
2670+
if *bin == "infernet" && infernet_systemd_managed() {
2671+
println!("→ infernet is managed by infernet.service (it updates itself); skipping");
2672+
continue;
2673+
}
26682674
println!("→ upgrading {bin}…");
26692675
match Command::new(path).args(*args).status() {
26702676
Ok(s) if s.success() => println!(" ✓ {bin} up to date"),
@@ -2704,13 +2710,17 @@ fn refresh_plugins() {
27042710
/// (and the daemon auto-updates itself), so the worker must not start, update or restart another
27052711
/// one: two daemons on one config dir fight over the socket, port and pidfile.
27062712
fn infernet_systemd_managed() -> bool {
2707-
Command::new("systemctl")
2708-
.args(["is-active", "--quiet", "infernet.service"])
2709-
.stdin(std::process::Stdio::null())
2710-
.stdout(std::process::Stdio::null())
2711-
.stderr(std::process::Stdio::null())
2712-
.status()
2713-
.is_ok_and(|s| s.success())
2713+
// Enabled, not only active: during the unit's own restart it is briefly "activating", and the
2714+
// worker must not slip a second daemon in then.
2715+
["is-enabled", "is-active"].iter().any(|verb| {
2716+
Command::new("systemctl")
2717+
.args([*verb, "--quiet", "infernet.service"])
2718+
.stdin(std::process::Stdio::null())
2719+
.stdout(std::process::Stdio::null())
2720+
.stderr(std::process::Stdio::null())
2721+
.status()
2722+
.is_ok_and(|s| s.success())
2723+
})
27142724
}
27152725

27162726
/// npm package the infernet installer pulls (`npm install -g @infernetprotocol/cli`).

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "c0mpute-monorepo",
3-
"version": "0.2.30",
3+
"version": "0.2.31",
44
"private": true,
55
"workspaces": [
66
"apps/*",

‎packages/shared/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@c0mpute/shared",
3-
"version": "0.2.30",
3+
"version": "0.2.31",
44
"private": true,
55
"type": "module",
66
"main": "./dist/index.js",

0 commit comments

Comments
 (0)