π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
feat: add targeted logging to sync services
Prateek Sunal4c1fc6f3283b
diff --git a/mobile/apps/photos/lib/services/collections_service.dart b/mobile/apps/photos/lib/services/collections_service.dartindex 1f8bd4fc6f..f12026d1cb 100644--- a/mobile/apps/photos/lib/services/collections_service.dart+++ b/mobile/apps/photos/lib/services/collections_service.dart@@ -120,10 +120,16 @@ class CollectionsService {final lastCollectionUpdationTime =_prefs.getInt(_collectionsSyncTimeKey) ?? 0;+ _logger.info("[COLLECTIONS] Starting sync");+// Might not have synced the collection fullyfinal fetchedCollections =await _fetchCollections(lastCollectionUpdationTime);+ _logger.info(+ "[COLLECTIONS] Fetched ${fetchedCollections.length} collections from API",+ );watch.log("remote fetch collections ${fetchedCollections.length}");+if (fetchedCollections.isEmpty) {return;}@@ -151,6 +157,7 @@ class CollectionsService {? collection.updationTime: maxUpdationTime;}+if (shouldFireDeleteEvent) {Bus.instance.fire(LocalPhotosUpdatedEvent(@@ -159,14 +166,19 @@ class CollectionsService {),);}+await _updateDB(updatedCollections);await _prefs.setInt(_collectionsSyncTimeKey, maxUpdationTime);watch.logAndReset("till DB insertion ${updatedCollections.length}");+ _logger.info("[COLLECTIONS] Updated ${updatedCollections.length} in DB");+for (final collection in fetchedCollections) {_cacheLocalPathAndCollection(collection);}+_logger.info("Collections synced");watch.log("${fetchedCollections.length} collection cached refreshed ");+if (fetchedCollections.isNotEmpty) {Bus.instance.fire(CollectionUpdatedEvent(diff --git a/mobile/apps/photos/lib/services/sync/sync_service.dart b/mobile/apps/photos/lib/services/sync/sync_service.dartindex a2633b4ba2..64bc41c451 100644--- a/mobile/apps/photos/lib/services/sync/sync_service.dart+++ b/mobile/apps/photos/lib/services/sync/sync_service.dart@@ -194,16 +194,24 @@ class SyncService {}Future<void> _doSync() async {+ _logger.info("[SYNC] Starting local sync");await _localSyncService.sync();+if (_localSyncService.hasCompletedFirstImport()) {+ _logger.info("[SYNC] Starting remote sync");await _remoteSyncService.sync();+final shouldSync = await _localSyncService.syncAll();if (shouldSync) {+ _logger.info("[SYNC] Starting second remote sync");await _remoteSyncService.sync();}+if (!isProcessBg) {await smartAlbumsService.syncSmartAlbums();}+ } else {+ _logger.info("[SYNC] First import not completed, skipping remote");}}