fix(core): allow account reopening after a failed close (#545)

Allow an account to reconnect after a previous shutdown reports an error, while preserving error reporting.

Add regression tests for failed and pending shutdown tasks.
This commit is contained in:
晚晴 authored and GitHub committed 2026-10-18 23:31:26 +08:00
1 parent 38fc636088
commit 1b74747251
2 files changed
+56 -1

No files matched your search

+7 -1
View File
@@ -434,7 +434,13 @@ export class BridgeManager implements BridgeSessionSource {
}
const closing = this.closingSessions_.get(uin);
const beforeOpen = closing ? Promise.all(closing).then(() => undefined) : undefined;
// allSettled, not all: a failed close stays in the bookkeeping (so
// dispose can still report it) but must not reject this gate — a
// rejected gate would keep the identity DB of every future session
// for this UIN closed until the process restarts.
const beforeOpen = closing
? Promise.allSettled(closing).then(() => undefined)
: undefined;
const bridge = new Bridge(IdentityService.openForUin(uin, 'data', beforeOpen));
this.bridges.set(uin, bridge);