

























@@ -10,6 +10,7 @@ const consumeGatewayRestartIntentSync = vi.fn(() => false);
1010const isGatewaySigusr1RestartExternallyAllowed = vi.fn(() => false);
1111const markGatewaySigusr1RestartHandled = vi.fn();
1212const peekGatewaySigusr1RestartReason = vi.fn<() => string | undefined>(() => undefined);
13+const resetGatewayRestartStateForInProcessRestart = vi.fn();
1314const scheduleGatewaySigusr1Restart = vi.fn((_opts?: { delayMs?: number; reason?: string }) => ({
1415ok: true,
1516pid: process.pid,
@@ -23,6 +24,7 @@ const getActiveTaskCount = vi.fn(() => 0);
2324const markGatewayDraining = vi.fn();
2425const waitForActiveTasks = vi.fn(async (_timeoutMs?: number) => ({ drained: true }));
2526const resetAllLanes = vi.fn();
27+const reloadTaskRegistryFromStore = vi.fn();
2628const getActiveBundledRuntimeDepsInstallCount = vi.fn(() => 0);
2729const waitForBundledRuntimeDepsInstallIdle = vi.fn(async (_timeoutMs?: number) => ({
2830drained: true,
@@ -71,6 +73,7 @@ vi.mock("../../infra/restart.js", () => ({
7173isGatewaySigusr1RestartExternallyAllowed: () => isGatewaySigusr1RestartExternallyAllowed(),
7274markGatewaySigusr1RestartHandled: () => markGatewaySigusr1RestartHandled(),
7375peekGatewaySigusr1RestartReason: () => peekGatewaySigusr1RestartReason(),
76+resetGatewayRestartStateForInProcessRestart: () => resetGatewayRestartStateForInProcessRestart(),
7477scheduleGatewaySigusr1Restart: (opts?: { delayMs?: number; reason?: string }) =>
7578scheduleGatewaySigusr1Restart(opts),
7679}));
@@ -91,6 +94,10 @@ vi.mock("../../process/command-queue.js", () => ({
9194resetAllLanes: () => resetAllLanes(),
9295}));
939697+vi.mock("../../tasks/runtime-internal.js", () => ({
98+reloadTaskRegistryFromStore: () => reloadTaskRegistryFromStore(),
99+}));
100+94101vi.mock("../../plugins/bundled-runtime-deps-activity.js", () => ({
95102getActiveBundledRuntimeDepsInstallCount: () => getActiveBundledRuntimeDepsInstallCount(),
96103waitForBundledRuntimeDepsInstallIdle: (timeoutMs?: number) =>
@@ -306,7 +313,7 @@ describe("runGatewayLoop", () => {
306313});
307314});
308315309-it("restarts after SIGUSR1 even when drain times out, and resets lanes for the new iteration", async () => {
316+it("restarts after SIGUSR1 even when drain times out, and resets runtime state for the new iteration", async () => {
310317vi.clearAllMocks();
311318loadConfig.mockReturnValue({
312319gateway: {
@@ -395,6 +402,8 @@ describe("runGatewayLoop", () => {
395402});
396403expect(markGatewaySigusr1RestartHandled).toHaveBeenCalledTimes(1);
397404expect(resetAllLanes).toHaveBeenCalledTimes(1);
405+expect(resetGatewayRestartStateForInProcessRestart).toHaveBeenCalledTimes(1);
406+expect(reloadTaskRegistryFromStore).toHaveBeenCalledTimes(1);
398407399408sigusr1();
400409@@ -407,6 +416,8 @@ describe("runGatewayLoop", () => {
407416expect(markGatewaySigusr1RestartHandled).toHaveBeenCalledTimes(2);
408417expect(markGatewayDraining).toHaveBeenCalledTimes(2);
409418expect(resetAllLanes).toHaveBeenCalledTimes(2);
419+expect(resetGatewayRestartStateForInProcessRestart).toHaveBeenCalledTimes(2);
420+expect(reloadTaskRegistryFromStore).toHaveBeenCalledTimes(2);
410421expect(acquireGatewayLock).toHaveBeenCalledTimes(3);
411422412423sigterm();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。