Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Guard sync diagnostic work for internal users

Prateek Sunalb034c512f491
diff --git a/mobile/apps/photos/lib/services/sync/local_sync_service.dart b/mobile/apps/photos/lib/services/sync/local_sync_service.dart
index 49700d1a85..deeb5fc3c8 100644
--- a/mobile/apps/photos/lib/services/sync/local_sync_service.dart
+++ b/mobile/apps/photos/lib/services/sync/local_sync_service.dart
@@ -330,6 +330,7 @@ class LocalSyncService {
required int fromTime,
required int toTime,
}) async {
+ final bool isInternalUser = flagService.internalUser;
final Tuple2<List<LocalPathAsset>, List<EnteFile>> result =
await getLocalPathAssetsAndFiles(fromTime, toTime);
@@ -360,7 +361,7 @@ class LocalSyncService {
conflictAlgorithm: SqliteAsyncConflictAlgorithm.ignore,
);
_logger.info('Inserted ${files.length} out of ${allFiles.length} files');
- if (allFiles.length != files.length) {
+ if (isInternalUser && allFiles.length != files.length) {
final sampleLocalIDs =
allFiles.take(3).map((file) => file.localID).toList();
_logger.internalInfo(
diff --git a/mobile/apps/photos/lib/services/sync/remote_sync_service.dart b/mobile/apps/photos/lib/services/sync/remote_sync_service.dart
index dccf44dbed..6c3c34d9dc 100644
--- a/mobile/apps/photos/lib/services/sync/remote_sync_service.dart
+++ b/mobile/apps/photos/lib/services/sync/remote_sync_service.dart
@@ -379,6 +379,7 @@ class RemoteSyncService {
Future<void> syncDeviceCollectionFilesForUpload() async {
_logger.info("Syncing device collections to be uploaded");
final int ownerID = _config.getUserID()!;
+ final bool isInternalUser = flagService.internalUser;
final deviceCollections = await _db.getDeviceCollections();
deviceCollections.removeWhere((element) => !element.shouldBackup);
@@ -404,7 +405,7 @@ class RemoteSyncService {
for (final deviceCollection in deviceCollections) {
final Set<String> localIDsToSync =
pathIdToLocalIDs[deviceCollection.id]?.toSet() ?? {};
- final int mappedCount = localIDsToSync.length;
+ final int mappedCount = isInternalUser ? localIDsToSync.length : 0;
if (deviceCollection.uploadStrategy == UploadStrategy.ifMissing) {
final Set<String> alreadyClaimedLocalIDs =
await _db.getLocalIDsMarkedForOrAlreadyUploaded(ownerID);
@@ -425,7 +426,7 @@ class RemoteSyncService {
}
if (localIDsToSync.isEmpty) {
- if (mappedCount == 0) {
+ if (isInternalUser && mappedCount == 0) {
_logger.internalInfo(
"[${deviceCollection.name}] upload-prep empty: "
"pathID=${deviceCollection.id} mappedFromPath=0",
@@ -464,7 +465,7 @@ class RemoteSyncService {
// new file entries, where we can store mapping for localID and
// corresponding collection ID
if (localIDsToSync.isNotEmpty) {
- final int postFilterCount = localIDsToSync.length;
+ final int postFilterCount = isInternalUser ? localIDsToSync.length : 0;
debugPrint(
'Adding new entries for ${localIDsToSync.length} files'
' for ${deviceCollection.name}',
@@ -486,8 +487,8 @@ class RemoteSyncService {
}
await _db.insertMultiple(newFilesToInsert);
final int missingFileRows =
- postFilterCount - fileFoundForLocalIDs.length;
- if (missingFileRows > 0) {
+ isInternalUser ? postFilterCount - fileFoundForLocalIDs.length : 0;
+ if (isInternalUser && missingFileRows > 0) {
final sample =
localIDsToSync.difference(fileFoundForLocalIDs).take(3);
_logger.internalWarning(