Skip to content

Commit 57e0e35

Browse files
committed
adds a cooperative-cancellation guard before loadOrCreateService
1 parent 41ff651 commit 57e0e35

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ConvosCore/Sources/ConvosCore/Sessions/SessionManager.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,12 @@ public final class SessionManager: SessionManagerProtocol, @unchecked Sendable {
385385
profileServicesTask?.cancel()
386386
profileServicesTask = Task { [weak self] in
387387
guard let self else { return }
388+
// Cancellation is cooperative: a task cancelled while still
389+
// queued (e.g. tearDownInbox during delete-all) still enters
390+
// its closure. Bail before loadOrCreateService, which would
391+
// otherwise rebuild a service from the just-wiped keychain and
392+
// re-register a fresh inbox.
393+
guard !Task.isCancelled else { return }
388394
await self.loadOrCreateService().startProfileServices()
389395
}
390396
}

0 commit comments

Comments
 (0)