android, desktop: withLongRunningApi when needed (#3710)

This commit is contained in:
Stanislav Dmitrenko
2024-01-20 00:01:33 +07:00
committed by GitHub
parent ab9a6dcab5
commit 5d8bb24d1c
21 changed files with 40 additions and 46 deletions

View File

@@ -104,7 +104,7 @@ class SimplexService: Service() {
if (wakeLock != null || isStartingService) return
val self = this
isStartingService = true
withBGApi {
withLongRunningApi(slow = 30_000, deadlock = 60_000) {
val chatController = ChatController
waitDbMigrationEnds(chatController)
try {
@@ -114,7 +114,7 @@ class SimplexService: Service() {
Log.w(chat.simplex.app.TAG, "SimplexService: problem with the database: $chatDbStatus")
showPassphraseNotification(chatDbStatus)
safeStopService()
return@withBGApi
return@withLongRunningApi
}
saveServiceState(self, ServiceState.STARTED)
wakeLock = (getSystemService(Context.POWER_SERVICE) as PowerManager).run {