[mob][photos] Small fix in index scheduling (#1813)

## Description

- Small fix for scenario where MLController fired quicker than we could
pause

## Tests

Tested on my pixel phone.
This commit is contained in:
Laurens Priem 2024-05-22 17:21:30 +05:30 committed by GitHub
commit 02366eb27f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -143,13 +143,21 @@ class FaceMlService {
}
_mlControllerStatus = event.shouldRun;
if (_mlControllerStatus) {
_logger.info(
"MLController allowed running ML, faces indexing starting (unless it's already fetching embeddings)",
);
unawaited(indexAndClusterAll());
if (_shouldPauseIndexingAndClustering) {
_shouldPauseIndexingAndClustering = false;
_logger.info(
"MLController allowed running ML, faces indexing undoing previous pause",
);
} else {
_logger.info(
"MLController allowed running ML, faces indexing starting",
);
unawaited(indexAndClusterAll());
}
} else {
_logger
.info("MLController stopped running ML, faces indexing will be paused (unless it's fetching embeddings)");
_logger.info(
"MLController stopped running ML, faces indexing will be paused (unless it's fetching embeddings)",
);
pauseIndexingAndClustering();
}
});