## Description

- Bug fixes
- Logging

## Tests

Tested on my pixel phone with remote embedding fetch disabled.
This commit is contained in:
Laurens Priem 2024-05-23 14:42:04 +05:30 committed by GitHub
commit 65de02d8d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 11 deletions

View file

@ -97,7 +97,7 @@ class FaceMlService {
bool _shouldSyncPeople = false; bool _shouldSyncPeople = false;
bool _isSyncing = false; bool _isSyncing = false;
final int _fileDownloadLimit = 10; final int _fileDownloadLimit = 5;
final int _embeddingFetchLimit = 200; final int _embeddingFetchLimit = 200;
Future<void> init({bool initializeImageMlIsolate = false}) async { Future<void> init({bool initializeImageMlIsolate = false}) async {
@ -152,8 +152,8 @@ class FaceMlService {
_logger.info( _logger.info(
"MLController allowed running ML, faces indexing starting", "MLController allowed running ML, faces indexing starting",
); );
unawaited(indexAndClusterAll());
} }
unawaited(indexAndClusterAll());
} else { } else {
_logger.info( _logger.info(
"MLController stopped running ML, faces indexing will be paused (unless it's fetching embeddings)", "MLController stopped running ML, faces indexing will be paused (unless it's fetching embeddings)",
@ -287,10 +287,6 @@ class FaceMlService {
return _functionLock.synchronized(() async { return _functionLock.synchronized(() async {
_resetInactivityTimer(); _resetInactivityTimer();
if (_shouldPauseIndexingAndClustering == false) {
return null;
}
final completer = Completer<dynamic>(); final completer = Completer<dynamic>();
final answerPort = ReceivePort(); final answerPort = ReceivePort();
@ -512,12 +508,18 @@ class FaceMlService {
rethrow; rethrow;
} }
} }
} } else {
if (!await canUseHighBandwidth()) { _logger.warning(
continue; 'Not fetching embeddings because user manually disabled it in debug options',
);
} }
final smallerChunks = chunk.chunks(_fileDownloadLimit); final smallerChunks = chunk.chunks(_fileDownloadLimit);
for (final smallestChunk in smallerChunks) { for (final smallestChunk in smallerChunks) {
if (!await canUseHighBandwidth()) {
_logger.info(
'stopping indexing because user is not connected to wifi',);
break outerLoop;
}
for (final enteFile in smallestChunk) { for (final enteFile in smallestChunk) {
if (_shouldPauseIndexingAndClustering) { if (_shouldPauseIndexingAndClustering) {
_logger.info("indexAllImages() was paused, stopping"); _logger.info("indexAllImages() was paused, stopping");
@ -543,8 +545,9 @@ class FaceMlService {
stopwatch.stop(); stopwatch.stop();
_logger.info( _logger.info(
"`indexAllImages()` finished. Fetched $fetchedCount and analyzed $fileAnalyzedCount images, in ${stopwatch.elapsed.inSeconds} seconds (avg of ${stopwatch.elapsed.inSeconds / fileAnalyzedCount} seconds per image, skipped $fileSkippedCount images. MLController status: $_mlControllerStatus)", "`indexAllImages()` finished. Fetched $fetchedCount and analyzed $fileAnalyzedCount images, in ${stopwatch.elapsed.inSeconds} seconds (avg of ${stopwatch.elapsed.inSeconds / fileAnalyzedCount} seconds per image, skipped $fileSkippedCount images)",
); );
_logStatus();
} catch (e, s) { } catch (e, s) {
_logger.severe("indexAllImages failed", e, s); _logger.severe("indexAllImages failed", e, s);
} finally { } finally {

View file

@ -12,7 +12,7 @@ description: ente photos application
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.8.106+630 version: 0.8.108+632
publish_to: none publish_to: none
environment: environment: