Use the taskQueue for checkPreKey operations

This commit is contained in:
Pete Walters 2024-01-31 13:44:10 -06:00 committed by GitHub
parent b35f4bb586
commit 671b0d3b67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -133,12 +133,15 @@ public class PreKeyManagerImpl: PreKeyManager {
let shouldPerformPniOp = hasPniIdentityKey(tx: tx)
Task { [weak self, taskManager, targets] in
try Task.checkCancellation()
try await taskManager.refresh(identity: .aci, targets: targets, auth: .implicit())
if shouldPerformPniOp {
let task = await Self.taskQueue.enqueue {
try Task.checkCancellation()
try await taskManager.refresh(identity: .pni, targets: targets, auth: .implicit())
try await taskManager.refresh(identity: .aci, targets: targets, auth: .implicit())
if shouldPerformPniOp {
try Task.checkCancellation()
try await taskManager.refresh(identity: .pni, targets: targets, auth: .implicit())
}
}
try await task.value
self?.refreshPreKeysDidSucceed()
}
}