删除咸鱼旧链路
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import type { Server } from "node:http";
|
||||
|
||||
import { stopScheduledJobs } from "../services/scheduler/scheduler-service.js";
|
||||
import { closeOcrService } from "../services/session/ocr.js";
|
||||
import { closeAllTencentBrowserSessions } from "../services/session/session.js";
|
||||
import { logError, logInfo } from "../utils/logger.js";
|
||||
import type { StartupState } from "./state.js";
|
||||
|
||||
export function createShutdownController(server: Server, startupState: StartupState) {
|
||||
export function createShutdownController(
|
||||
server: Server,
|
||||
startupState: StartupState
|
||||
) {
|
||||
let shutdownStarted = false;
|
||||
|
||||
async function shutdown(signal: string) {
|
||||
@@ -16,22 +17,10 @@ export function createShutdownController(server: Server, startupState: StartupSt
|
||||
|
||||
shutdownStarted = true;
|
||||
startupState.phase = "shutting_down";
|
||||
logInfo("[shutdown]", `received ${signal}, closing browser sessions and HTTP server`);
|
||||
logInfo("[shutdown]", `received ${signal}, closing HTTP server`);
|
||||
|
||||
stopScheduledJobs();
|
||||
|
||||
try {
|
||||
await closeAllTencentBrowserSessions({ markClosed: true });
|
||||
} catch (error) {
|
||||
logError("[shutdown]", "failed to close browser sessions", error);
|
||||
}
|
||||
|
||||
try {
|
||||
await closeOcrService();
|
||||
} catch (error) {
|
||||
logError("[shutdown]", "failed to close OCR service", error);
|
||||
}
|
||||
|
||||
if (!server.listening) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user