Skip to content

Commit ddb1472

Browse files
fix(server): start recovered service before unit reconciliation
1 parent b814ae4 commit ddb1472

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎apps/server/src/serviceLauncher.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,12 @@ export class Launcher {
658658
if (update?.status !== "pending") {
659659
if (update !== undefined) {
660660
await discardDatabaseBackup(this.#baseDir, update.id).catch(() => undefined);
661-
await this.#repointServiceUnit(this.#state.activeVersion);
662661
}
663-
await this.#startChild(this.#state.activeVersion, "active", update);
662+
try {
663+
await this.#startChild(this.#state.activeVersion, "active", update);
664+
} finally {
665+
if (update !== undefined) await this.#repointServiceUnit(this.#state.activeVersion);
666+
}
664667
return;
665668
}
666669
if (await databaseRestorePending(this.#baseDir, update)) {

‎docs/internals/server-updates.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ is preserved.
2929

3030
launchd keeps its loaded definition until the next bootstrap; systemd keeps its
3131
loaded definition until daemon-reload. After a deferred protocol-3 upgrade, either
32-
manager can therefore respawn the old launcher, which cannot read protocol-4
33-
state. One local service restart is required to load the updated launcher.
32+
manager can therefore respawn the old launcher, but the new runtime refuses to run
33+
under it. The service cannot recover until a local restart through
34+
`t3 update --yes` or `t3 service install` loads the updated launcher.
3435

3536
## Commit boundary
3637

‎docs/user/updating.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ The offered action depends on how the server runs:
8282
| **Copy update command** | Run the command on the named host to update the detected global npm install, then restart the server with your usual options. |
8383
| **Copy relaunch command** | Stop the command-line server on its host and relaunch with the copied command, keeping your usual subcommand and options. This does not update an installed `t3` command. |
8484

85-
Older background services need one local `t3 update --yes` or `t3 service install`
86-
that restarts the service before they can accept remote updates.
85+
For older background services, run `t3 update --yes` or `t3 service install` locally
86+
once and restart when prompted; deferring can leave the service stopped after a
87+
crash or restart until you run `t3 service restart`.
8788

8889
On the host, run:
8990

0 commit comments

Comments
 (0)