Skip to content

Commit 7f333c1

Browse files
committed
fix: save timestamp for automatic uploads process at the beginning to avoid race conditions
1 parent abc810e commit 7f333c1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

owncloudApp/src/main/java/com/owncloud/android/workers/AutomaticUploadsWorker.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ class AutomaticUploadsWorker(
122122
WorkManager.getInstance(appContext).cancelUniqueWork(AUTOMATIC_UPLOADS_WORKER)
123123
}
124124

125-
private fun syncFolder(folderBackUpConfiguration: FolderBackUpConfiguration?) {
126-
if (folderBackUpConfiguration == null) return
127-
125+
private fun syncFolder(folderBackUpConfiguration: FolderBackUpConfiguration) {
128126
val syncType = when {
129127
folderBackUpConfiguration.isPictureUploads -> SyncType.PICTURE_UPLOADS
130128
folderBackUpConfiguration.isVideoUploads -> SyncType.VIDEO_UPLOADS
@@ -133,6 +131,7 @@ class AutomaticUploadsWorker(
133131
}
134132

135133
val currentTimestamp = System.currentTimeMillis()
134+
updateTimestamp(folderBackUpConfiguration, syncType, currentTimestamp)
136135

137136
val localPicturesDocumentFiles: List<DocumentFile> = getFilesReadyToUpload(
138137
syncType = syncType,
@@ -166,7 +165,6 @@ class AutomaticUploadsWorker(
166165
chargingOnly = folderBackUpConfiguration.chargingOnly
167166
)
168167
}
169-
updateTimestamp(folderBackUpConfiguration, syncType, currentTimestamp)
170168
}
171169

172170
private fun showNotification(

0 commit comments

Comments
 (0)