Files
HarborForge.OpenclawPlugin/plugin/hooks/gateway-stop.ts

24 lines
656 B
TypeScript

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);
});
}