0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-07 00:50:23 -05: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 // called when the system has to stop this worker because constraints are
// no longer met or the system needs resources for more important tasks // no longer met or the system needs resources for more important tasks
Handler(Looper.getMainLooper()).postAtFrontOfQueue { Handler(Looper.getMainLooper()).postAtFrontOfQueue {
backgroundChannel.invokeMethod("systemStop", null) if (::backgroundChannel.isInitialized) {
backgroundChannel.invokeMethod("systemStop", null)
}
} }
waitOnSetForegroundAsync() waitOnSetForegroundAsync()
// cannot await/get(block) on resolvableFuture as its already cancelled (would throw CancellationException) // cannot await/get(block) on resolvableFuture as its already cancelled (would throw CancellationException)