Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix: don't touch ml stuff

Prateek Sunal40f979ae2dfe
diff --git a/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart b/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart
index 8f19c83c19..dfc663f85c 100644
--- a/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart
@@ -8,7 +8,6 @@ import "package:flutter/foundation.dart";
import "package:logging/logging.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/compute_control_event.dart";
-import "package:photos/main.dart";
import "package:thermal/thermal.dart";
enum _ComputeRunState {
@@ -73,7 +72,7 @@ class ComputeController {
bool requestCompute({bool ml = false, bool stream = false}) {
_logger.info("Requesting compute: ml: $ml, stream: $stream");
- if (!_isDeviceHealthy || !isProcessBg && !_canRunGivenUserInteraction()) {
+ if (!_isDeviceHealthy || !_canRunGivenUserInteraction()) {
_logger.info("Device not healthy or user interacting, denying request.");
return false;
}
diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart b/mobile/apps/photos/lib/services/machine_learning/ml_service.dart
index 48849d2b12..5425f3160a 100644
--- a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/ml_service.dart
@@ -10,7 +10,6 @@ import "package:photos/db/files_db.dart";
import "package:photos/db/ml/db.dart";
import "package:photos/events/compute_control_event.dart";
import "package:photos/events/people_changed_event.dart";
-import "package:photos/main.dart";
import "package:photos/models/ml/face/face.dart";
import "package:photos/models/ml/ml_versions.dart";
import "package:photos/service_locator.dart";
@@ -70,33 +69,31 @@ class MLService {
_logger.info("client: $client");
// Listen on ComputeController
- if (!isProcessBg) {
- Bus.instance.on<ComputeControlEvent>().listen((event) {
- if (!flagService.hasGrantedMLConsent) {
- return;
- }
+ Bus.instance.on<ComputeControlEvent>().listen((event) {
+ if (!flagService.hasGrantedMLConsent) {
+ return;
+ }
- _mlControllerStatus = event.shouldRun;
- if (_mlControllerStatus) {
- if (_shouldPauseIndexingAndClustering) {
- _cancelPauseIndexingAndClustering();
- _logger.info(
- "MLController allowed running ML, faces indexing undoing previous pause",
- );
- } else {
- _logger.info(
- "MLController allowed running ML, faces indexing starting",
- );
- }
- unawaited(runAllML());
+ _mlControllerStatus = event.shouldRun;
+ if (_mlControllerStatus) {
+ if (_shouldPauseIndexingAndClustering) {
+ _cancelPauseIndexingAndClustering();
+ _logger.info(
+ "MLController allowed running ML, faces indexing undoing previous pause",
+ );
} else {
_logger.info(
- "MLController stopped running ML, faces indexing will be paused (unless it's fetching embeddings)",
+ "MLController allowed running ML, faces indexing starting",
);
- pauseIndexingAndClustering();
}
- });
- }
+ unawaited(runAllML());
+ } else {
+ _logger.info(
+ "MLController stopped running ML, faces indexing will be paused (unless it's fetching embeddings)",
+ );
+ pauseIndexingAndClustering();
+ }
+ });
_isInitialized = true;
_logger.info('init done');
@@ -139,7 +136,7 @@ class MLService {
);
await clusterAllImages();
}
- if (!isProcessBg && _mlControllerStatus == true) {
+ if (_mlControllerStatus == true) {
// refresh discover section
magicCacheService.updateCache(forced: force).ignore();
// refresh memories section
@@ -151,7 +148,7 @@ class MLService {
if ((await mlDataDB.getUnclusteredFaceCount()) > 0) {
await clusterAllImages();
}
- if (!isProcessBg && _mlControllerStatus == true) {
+ if (_mlControllerStatus == true) {
// refresh discover section
magicCacheService.updateCache().ignore();
// refresh memories section (only runs if forced is true)
@@ -164,7 +161,7 @@ class MLService {
_logger.severe("ML finished running");
_isRunningML = false;
computeController.releaseCompute(ml: true);
- if (!isProcessBg) VideoPreviewService.instance.queueFiles();
+ VideoPreviewService.instance.queueFiles();
}
}