Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move background ML gating before service init

Prateek Sunal5f9fcd7e45a8
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dart
index 9d40a8a231..30a3692177 100644
--- a/mobile/apps/photos/lib/main.dart
+++ b/mobile/apps/photos/lib/main.dart
@@ -222,8 +222,6 @@ Future<void> _runMinimally(String taskId, TimeLogger tlog) async {
await _homeWidgetSync(true);
if (flagService.enableMLInBackground && hasGrantedMLConsent) {
- await MLService.instance.init();
- await PersonService.init(entityService, MLDataDB.instance, prefs);
await controller.init();
final canRunML = controller.requestCompute(ml: true);
if (!canRunML) {
@@ -231,6 +229,8 @@ Future<void> _runMinimally(String taskId, TimeLogger tlog) async {
"[BG TASK] skipping ML, compute requirements not satisfied",
);
} else {
+ await MLService.instance.init();
+ await PersonService.init(entityService, MLDataDB.instance, prefs);
await MLService.instance.runAllML(force: true);
}
}
diff --git a/mobile/apps/photos/lib/utils/isolate/super_isolate.dart b/mobile/apps/photos/lib/utils/isolate/super_isolate.dart
index 0120f417ca..87460d295a 100644
--- a/mobile/apps/photos/lib/utils/isolate/super_isolate.dart
+++ b/mobile/apps/photos/lib/utils/isolate/super_isolate.dart
@@ -137,7 +137,6 @@ abstract class SuperIsolate {
final logs = receivedMessage['logs'] as List<String>;
IsolateLogger.handLogStringsToMainLogger(logs);
final data = receivedMessage['data'];
-
if (data is Map && data.containsKey('error')) {
// Handle the error
final errorMessage = data['error'];