From b2c274e73bce5ee7b716659e9bd698a5d3655c59 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Wed, 15 May 2024 11:03:31 +0530 Subject: [PATCH] [mob][photos] Extra safety checks for hooking MLController --- .../machine_learning/face_ml/face_ml_service.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart index 50c0e117c..d4c1a891f 100644 --- a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart +++ b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart @@ -257,7 +257,7 @@ class FaceMlService { return _functionLock.synchronized(() async { _resetInactivityTimer(); - if (isImageIndexRunning == false) { + if (isImageIndexRunning == false || MachineLearningController.instance.canRunML == false) { return null; } @@ -1339,8 +1339,12 @@ class FaceMlService { /// Checks if the ente file to be analyzed actually can be analyzed: it must be uploaded and in the correct format. void _checkEnteFileForID(EnteFile enteFile) { if (_skipAnalysisEnteFile(enteFile, {})) { - _logger.severe( - "Skipped analysis of image with enteFile ${enteFile.toString()} because it is the wrong format or has no uploadedFileID", + _logger.warning( + '''Skipped analysis of image with enteFile, it might be the wrong format or has no uploadedFileID, or MLController doesn't allow it to run. + enteFile: ${enteFile.toString()} + isImageIndexRunning: $isImageIndexRunning + canRunML: ${MachineLearningController.instance.canRunML} + ''', ); throw CouldNotRetrieveAnyFileData(); }