fix: gate gateway restarts and discord abort reconnects

This commit is contained in:
Peter Steinberger
2026-01-18 23:25:04 +00:00
parent e97bcf4dae
commit d802844bd6
11 changed files with 143 additions and 8 deletions

View File

@@ -1,5 +1,9 @@
import type { startGatewayServer } from "../../gateway/server.js";
import { createSubsystemLogger } from "../../logging.js";
import {
consumeGatewaySigusr1RestartAuthorization,
isGatewaySigusr1RestartExternallyAllowed,
} from "../../infra/restart.js";
import { createSubsystemLogger } from "../../logging/subsystem.js";
import type { defaultRuntime } from "../../runtime.js";
const gatewayLog = createSubsystemLogger("gateway");
@@ -67,6 +71,13 @@ export async function runGatewayLoop(params: {
};
const onSigusr1 = () => {
gatewayLog.info("signal SIGUSR1 received");
const authorized = consumeGatewaySigusr1RestartAuthorization();
if (!authorized && !isGatewaySigusr1RestartExternallyAllowed()) {
gatewayLog.warn(
"SIGUSR1 restart ignored (not authorized; enable commands.restart or use gateway tool).",
);
return;
}
request("restart", "SIGUSR1");
};