mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-10-31 06:31:58 +01:00
On Bun 1.4 the node adapter's reader cancel closes the stream before the request abort fires, so the abort listener's controller.close() threw ERR_INVALID_STATE as an uncaught exception and the process shut itself down whenever a dashboard tab disconnected. Both SSE routes now guard the close and clear their timers on cancel too. A shutdown forced by an uncaught exception or unhandled rejection now exits with status 1 instead of 0, so a unit with Restart=on-failure (the Proxmox community script) starts the service again.
16 lines
589 B
TypeScript
16 lines
589 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { shutdownExitCode } from "./shutdown-manager";
|
|
|
|
describe("shutdownExitCode (#465)", () => {
|
|
test("a crash-driven shutdown exits non-zero so Restart=on-failure restarts the service", () => {
|
|
expect(shutdownExitCode("UNCAUGHT_EXCEPTION")).toBe(1);
|
|
expect(shutdownExitCode("UNHANDLED_REJECTION")).toBe(1);
|
|
});
|
|
|
|
test("a signal-driven stop is a clean exit", () => {
|
|
expect(shutdownExitCode("SIGTERM")).toBe(0);
|
|
expect(shutdownExitCode("SIGINT")).toBe(0);
|
|
expect(shutdownExitCode("SIGHUP")).toBe(0);
|
|
});
|
|
});
|