add auto-updater

This commit is contained in:
2026-09-08 17:33:55 +00:00
parent d1793cc11b
commit 8763226ccd
12 changed files with 685 additions and 29 deletions
+14
View File
@@ -74,6 +74,7 @@ export class AppService extends EventEmitter<AppEventMap> {
onRemoved: () => void;
}
>();
private stopPromise: Promise<void> | null = null;
static async create(
seed: string,
@@ -388,4 +389,17 @@ export class AppService extends EventEmitter<AppEventMap> {
}),
);
}
/** Stop background services before the process exits or updates. */
async stop(): Promise<void> {
this.stopPromise ??= (async () => {
await Promise.allSettled([
this.rates.stop(),
this.electrum.stop?.() ?? Promise.resolve(),
...this.invitations.map((invitation) => invitation.stop()),
]);
await this.engine.stop();
})();
await this.stopPromise;
}
}