fix: verify gateway restart health after daemon restart
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { Writable } from "node:stream";
|
||||
import { loadConfig } from "../../config/config.js";
|
||||
import { resolveIsNixMode } from "../../config/paths.js";
|
||||
import { checkTokenDrift } from "../../daemon/service-audit.js";
|
||||
@@ -18,6 +19,13 @@ type DaemonLifecycleOptions = {
|
||||
json?: boolean;
|
||||
};
|
||||
|
||||
type RestartPostCheckContext = {
|
||||
json: boolean;
|
||||
stdout: Writable;
|
||||
warnings: string[];
|
||||
fail: (message: string, hints?: string[]) => void;
|
||||
};
|
||||
|
||||
async function maybeAugmentSystemdHints(hints: string[]): Promise<string[]> {
|
||||
if (process.platform !== "linux") {
|
||||
return hints;
|
||||
@@ -240,6 +248,7 @@ export async function runServiceRestart(params: {
|
||||
renderStartHints: () => string[];
|
||||
opts?: DaemonLifecycleOptions;
|
||||
checkTokenDrift?: boolean;
|
||||
postRestartCheck?: (ctx: RestartPostCheckContext) => Promise<void>;
|
||||
}): Promise<boolean> {
|
||||
const json = Boolean(params.opts?.json);
|
||||
const { stdout, emit, fail } = createActionIO({ action: "restart", json });
|
||||
@@ -295,6 +304,9 @@ export async function runServiceRestart(params: {
|
||||
|
||||
try {
|
||||
await params.service.restart({ env: process.env, stdout });
|
||||
if (params.postRestartCheck) {
|
||||
await params.postRestartCheck({ json, stdout, warnings, fail });
|
||||
}
|
||||
let restarted = true;
|
||||
try {
|
||||
restarted = await params.service.isLoaded({ env: process.env });
|
||||
|
||||
Reference in New Issue
Block a user