1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

fix(mobile): background task crashing on Android (#12314)

This commit is contained in:
Alex 2024-09-04 22:39:50 -05:00 committed by GitHub
parent f4ec842577
commit f26d47c8d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -118,7 +118,9 @@ class BackupWorker(ctx: Context, params: WorkerParameters) : ListenableWorker(ct
// called when the system has to stop this worker because constraints are
// no longer met or the system needs resources for more important tasks
Handler(Looper.getMainLooper()).postAtFrontOfQueue {
backgroundChannel.invokeMethod("systemStop", null)
if (::backgroundChannel.isInitialized) {
backgroundChannel.invokeMethod("systemStop", null)
}
}
waitOnSetForegroundAsync()
// cannot await/get(block) on resolvableFuture as its already cancelled (would throw CancellationException)