[mob][photos] Keep triggering ML on ML settings page

This commit is contained in:
laurenspriem
2024-08-22 16:37:09 +02:00
parent 5eb153a310
commit bb6ac34920
2 changed files with 11 additions and 0 deletions

View File

@@ -55,6 +55,7 @@ class MLService {
bool _showClusteringIsHappening = false;
bool _mlControllerStatus = false;
bool _isIndexingOrClusteringRunning = false;
bool _isRunningML = false;
bool _shouldPauseIndexingAndClustering = false;
static const int _fileDownloadLimit = 10;
@@ -118,6 +119,7 @@ class MLService {
_mlControllerStatus = true;
}
if (_cannotRunMLFunction() && !force) return;
_isRunningML = true;
await sync();
@@ -134,6 +136,14 @@ class MLService {
} catch (e, s) {
_logger.severe("runAllML failed", e, s);
rethrow;
} finally {
_isRunningML = false;
}
}
void triggerML() {
if (_mlControllerStatus && !_isIndexingOrClusteringRunning && !_isRunningML) {
unawaited(runAllML());
}
}

View File

@@ -363,6 +363,7 @@ class MLStatusWidgetState extends State<MLStatusWidget> {
void initState() {
super.initState();
_timer = Timer.periodic(const Duration(seconds: 10), (timer) {
MLService.instance.triggerML();
setState(() {});
});
}