π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix throttling when multipart is disabled
Neeraj Gupta0f101110e661
diff --git a/mobile/apps/photos/lib/services/sync/remote_sync_service.dart b/mobile/apps/photos/lib/services/sync/remote_sync_service.dartindex 4cee087a45..d4523b27d0 100644--- a/mobile/apps/photos/lib/services/sync/remote_sync_service.dart+++ b/mobile/apps/photos/lib/services/sync/remote_sync_service.dart@@ -153,7 +153,7 @@ class RemoteSyncService {await syncDeviceCollectionFilesForUpload();final hasMoreFilesToBackup = (await _getFilesToBeUploaded()).isNotEmpty;_logger.info("hasMoreFilesToBackup?" + hasMoreFilesToBackup.toString());- if (hasMoreFilesToBackup && !_shouldThrottleSync()) {+ if (hasMoreFilesToBackup) {// Skipping a resync to ensure that files that were ignored in this// session are not processed nowawait sync();@@ -548,7 +548,7 @@ class RemoteSyncService {return originalFiles;}final bool shouldRemoveVideos =- !_config.shouldBackupVideos() || _shouldThrottleSync();+ !_config.shouldBackupVideos() || bgWithoutResumableUpload;final ignoredIDs = await IgnoredFilesService.instance.idToIgnoreReasonMap;bool shouldSkipUploadFunc(EnteFile file) {return IgnoredFilesService.instance.shouldSkipUpload(ignoredIDs, file);@@ -606,7 +606,7 @@ class RemoteSyncService {final List<Future> futures = [];for (final file in filesToBeUploaded) {- if (_shouldThrottleSync() &&+ if (shouldThrottleUpload &&futures.length >= kMaximumPermissibleUploadsInThrottledMode) {_logger.info("Skipping some new files as we are throttling uploads");break;@@ -621,7 +621,7 @@ class RemoteSyncService {}for (final uploadedFileID in updatedFileIDs) {- if (_shouldThrottleSync() &&+ if (shouldThrottleUpload &&futures.length >= kMaximumPermissibleUploadsInThrottledMode) {_logger.info("Skipping some updated files as we are throttling uploads");@@ -935,9 +935,15 @@ class RemoteSyncService {return kEditTimeFeatureReleaseTime;}- bool _shouldThrottleSync() {- return !flagService.enableMobMultiPart ||- !localSettings.userEnabledMultiplePart;+ bool get shouldThrottleUpload {+ return !Platform.isAndroid && !AppLifecycleService.instance.isForeground;+ }++ bool get bgWithoutResumableUpload {+ // if multiple part is enabled, then we are not throttling uploads in bg+ return !(flagService.enableMobMultiPart &&+ localSettings.userEnabledMultiplePart) &&+ !AppLifecycleService.instance.isForeground;}// _sortByTime sort by creation time (desc).