mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-17 08:41:10 +00:00
Add postbox transaction guard
This commit is contained in:
parent
841ecaba39
commit
f00b1ea21b
@ -324,6 +324,8 @@ public final class SharedWakeupManager {
|
|||||||
private func updateAccounts(hasTasks: Bool) {
|
private func updateAccounts(hasTasks: Bool) {
|
||||||
if self.inForeground || self.hasActiveAudioSession || self.isInBackgroundExtension || (hasTasks && self.currentExternalCompletion != nil) || self.activeExplicitExtensionTimer != nil {
|
if self.inForeground || self.hasActiveAudioSession || self.isInBackgroundExtension || (hasTasks && self.currentExternalCompletion != nil) || self.activeExplicitExtensionTimer != nil {
|
||||||
for (account, primary, tasks) in self.accountsAndTasks {
|
for (account, primary, tasks) in self.accountsAndTasks {
|
||||||
|
account.postbox.setCanBeginTransactions(true)
|
||||||
|
|
||||||
if (self.inForeground && primary) || !tasks.isEmpty || (self.activeExplicitExtensionTimer != nil && primary) {
|
if (self.inForeground && primary) || !tasks.isEmpty || (self.activeExplicitExtensionTimer != nil && primary) {
|
||||||
account.shouldBeServiceTaskMaster.set(.single(.always))
|
account.shouldBeServiceTaskMaster.set(.single(.always))
|
||||||
} else {
|
} else {
|
||||||
@ -335,6 +337,7 @@ public final class SharedWakeupManager {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (account, _, _) in self.accountsAndTasks {
|
for (account, _, _) in self.accountsAndTasks {
|
||||||
|
account.postbox.setCanBeginTransactions(false)
|
||||||
account.shouldBeServiceTaskMaster.set(.single(.never))
|
account.shouldBeServiceTaskMaster.set(.single(.never))
|
||||||
account.shouldKeepOnlinePresence.set(.single(false))
|
account.shouldKeepOnlinePresence.set(.single(false))
|
||||||
account.shouldKeepBackgroundDownloadConnections.set(.single(false))
|
account.shouldKeepBackgroundDownloadConnections.set(.single(false))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user