refactor: manage monitor via gateway hooks

This commit is contained in:
2026-04-04 00:44:33 +00:00
parent 3b0ea0ad12
commit 038862ef8c
36 changed files with 244 additions and 1932 deletions

View File

@@ -0,0 +1,23 @@
import { stopManagedMonitor } from '../core/managed-monitor';
export function registerGatewayStopHook(api: any, deps: {
logger: any;
getMetaPushInterval: () => ReturnType<typeof setInterval> | null;
clearMetaPushInterval: () => void;
stopCalendarScheduler: () => void;
}) {
const { logger, getMetaPushInterval, clearMetaPushInterval, stopCalendarScheduler } = deps;
api.on('gateway_stop', () => {
logger.info('HarborForge plugin stopping');
const handle = getMetaPushInterval();
if (handle) {
clearInterval(handle);
clearMetaPushInterval();
}
stopCalendarScheduler();
stopManagedMonitor(logger);
});
}