mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 02:01:25 +00:00
feat(update): add core auto-updater and dry-run preview
This commit is contained in:
@@ -15,6 +15,7 @@ export function createGatewayCloseHandler(params: {
|
||||
pluginServices: PluginServicesHandle | null;
|
||||
cron: { stop: () => void };
|
||||
heartbeatRunner: HeartbeatRunner;
|
||||
updateCheckStop?: (() => void) | null;
|
||||
nodePresenceTimers: Map<string, ReturnType<typeof setInterval>>;
|
||||
broadcast: (event: string, payload: unknown, opts?: { dropIfSlow?: boolean }) => void;
|
||||
tickInterval: ReturnType<typeof setInterval>;
|
||||
@@ -70,6 +71,11 @@ export function createGatewayCloseHandler(params: {
|
||||
await stopGmailWatcher();
|
||||
params.cron.stop();
|
||||
params.heartbeatRunner.stop();
|
||||
try {
|
||||
params.updateCheckStop?.();
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
for (const timer of params.nodePresenceTimers.values()) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
|
||||
@@ -632,17 +632,17 @@ export async function startGatewayServer(
|
||||
log,
|
||||
isNixMode,
|
||||
});
|
||||
if (!minimalTestGateway) {
|
||||
scheduleGatewayUpdateCheck({
|
||||
cfg: cfgAtStart,
|
||||
log,
|
||||
isNixMode,
|
||||
onUpdateAvailableChange: (updateAvailable) => {
|
||||
const payload: GatewayUpdateAvailableEventPayload = { updateAvailable };
|
||||
broadcast(GATEWAY_EVENT_UPDATE_AVAILABLE, payload, { dropIfSlow: true });
|
||||
},
|
||||
});
|
||||
}
|
||||
const stopGatewayUpdateCheck = minimalTestGateway
|
||||
? () => {}
|
||||
: scheduleGatewayUpdateCheck({
|
||||
cfg: cfgAtStart,
|
||||
log,
|
||||
isNixMode,
|
||||
onUpdateAvailableChange: (updateAvailable) => {
|
||||
const payload: GatewayUpdateAvailableEventPayload = { updateAvailable };
|
||||
broadcast(GATEWAY_EVENT_UPDATE_AVAILABLE, payload, { dropIfSlow: true });
|
||||
},
|
||||
});
|
||||
const tailscaleCleanup = minimalTestGateway
|
||||
? null
|
||||
: await startGatewayTailscaleExposure({
|
||||
@@ -730,6 +730,7 @@ export async function startGatewayServer(
|
||||
pluginServices,
|
||||
cron,
|
||||
heartbeatRunner,
|
||||
updateCheckStop: stopGatewayUpdateCheck,
|
||||
nodePresenceTimers,
|
||||
broadcast,
|
||||
tickInterval,
|
||||
|
||||
Reference in New Issue
Block a user