add auto-updater
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user