Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: logging in bg

Prateek Sunal60b040f54b49
diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart
index 4f9e1815d9..041cb626d9 100644
--- a/mobile/lib/main.dart
+++ b/mobile/lib/main.dart
@@ -126,20 +126,26 @@ Future<void> _homeWidgetSync([bool isBackground = false]) async {
}
Future<void> runBackgroundTask(String taskId, {String mode = 'normal'}) async {
- try {
- final cancellableOp = CancelableOperation.fromFuture(_runMinimally(taskId));
-
- if (Platform.isIOS) {
- _scheduleSuicide(
- kBGTaskTimeout,
- taskId,
- cancellableOp,
- );
- }
- await cancellableOp.valueOrCancellation();
- } catch (e, s) {
- _logger.severe("Error in background task", e, s);
- }
+ await _runWithLogs(
+ () async {
+ try {
+ final cancellableOp =
+ CancelableOperation.fromFuture(_runMinimally(taskId));
+
+ if (Platform.isIOS) {
+ _scheduleSuicide(
+ kBGTaskTimeout,
+ taskId,
+ cancellableOp,
+ );
+ }
+ await cancellableOp.valueOrCancellation();
+ } catch (e, s) {
+ _logger.severe("Error in background task", e, s);
+ }
+ },
+ prefix: "[bg]",
+ );
}
Future<void> _runMinimally(String taskId) async {