Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Add minimal sync recovery diagnostics (#9682)

Prateek Sunal8da91c7b12cf
diff --cc mobile/apps/photos/lib/services/sync/local_sync_service.dart
index 9d91f1e4dc,25fbb6f041..89cbb9a410
--- a/mobile/apps/photos/lib/services/sync/local_sync_service.dart
+++ b/mobile/apps/photos/lib/services/sync/local_sync_service.dart
@@@ -237,11 -237,36 +237,38 @@@ class LocalSyncService
),
);
}
+ if (flagService.syncRecoveryDiagnostics) {
+ final int newMappingCount =
+ localDiffResult.newPathToLocalIDs?.values.fold<int>(
+ 0,
+ (sum, ids) => sum + ids.length,
+ ) ??
+ 0;
+ final int deletedMappingCount =
+ localDiffResult.deletePathToLocalIDs?.values.fold<int>(
+ 0,
+ (sum, ids) => sum + ids.length,
+ ) ??
+ 0;
+ if (newMappingCount > 0 || deletedMappingCount > 0 || hasUnsyncedFiles) {
+ final sampleRecovered = (localDiffResult.uniqueLocalFiles ?? [])
+ .take(3)
+ .map((file) => file.localID)
+ .toList();
+ _logger.info(
+ "syncAll recovery: "
+ "newFiles=${localDiffResult.uniqueLocalFiles?.length ?? 0}, "
+ "newMappings=$newMappingCount, "
+ "deletedMappings=$deletedMappingCount, "
+ "sampleRecovered=$sampleRecovered",
+ );
+ }
+ }
_logger.info("syncAll took ${stopwatch.elapsed.inMilliseconds}ms ");
- return hasUnsyncedFiles;
+ // syncAll can repair mappings without inserting new local files.
+ // We still need the follow-up remote sync to promote those entries.
+ return hasUnsyncedFiles || hasAnyMappingChanged;
}
Future<void> ignoreUpload(EnteFile file, InvalidFileError error) async {