From fc8122b18eb7d1f1b14a1ec125ab2e99d34baa88 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Thu, 21 Mar 2024 16:52:52 +0530 Subject: [PATCH] Add indexing debug cooldown --- .../machine_learning/face_ml/face_ml_service.dart | 8 ++++++++ 1 file changed, 8 insertions(+) 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 c8a09bbff7..8ed8331781 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 @@ -511,6 +511,14 @@ class FaceMlService { (previousValue, element) => previousValue + (element ? 1 : 0), ); fileAnalyzedCount += sumFutures; + + // TODO: remove this cooldown later. Cooldown of one minute every 400 images + if (fileAnalyzedCount > 400 && fileAnalyzedCount % 400 < kParallelism) { + _logger.info( + "indexAllImages() analyzed $fileAnalyzedCount images, cooldown for 1 minute", + ); + await Future.delayed(const Duration(minutes: 1)); + } } stopwatch.stop();