FilesUploadWorker: add some more logging

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey 2022-10-26 09:43:01 +02:00
parent bbb55b7f28
commit a4adf83efe
No known key found for this signature in database
GPG key ID: 2585783189A62105

View file

@ -74,6 +74,7 @@ class FilesUploadWorker(
override fun doWork(): Result { override fun doWork(): Result {
val accountName = inputData.getString(ACCOUNT) val accountName = inputData.getString(ACCOUNT)
if (accountName.isNullOrEmpty()) { if (accountName.isNullOrEmpty()) {
Log_OC.w(TAG, "User was null for file upload worker")
return Result.failure() // user account is needed return Result.failure() // user account is needed
} }
@ -81,11 +82,13 @@ class FilesUploadWorker(
var currentAndPendingUploadsForAccount = var currentAndPendingUploadsForAccount =
uploadsStorageManager.getCurrentAndPendingUploadsForAccount(accountName) uploadsStorageManager.getCurrentAndPendingUploadsForAccount(accountName)
while (currentAndPendingUploadsForAccount.isNotEmpty()) { while (currentAndPendingUploadsForAccount.isNotEmpty()) {
Log_OC.d(TAG, "Handling ${currentAndPendingUploadsForAccount.size} uploads for account $accountName")
handlePendingUploads(currentAndPendingUploadsForAccount, accountName) handlePendingUploads(currentAndPendingUploadsForAccount, accountName)
currentAndPendingUploadsForAccount = currentAndPendingUploadsForAccount =
uploadsStorageManager.getCurrentAndPendingUploadsForAccount(accountName) uploadsStorageManager.getCurrentAndPendingUploadsForAccount(accountName)
} }
Log_OC.d(TAG, "No more pending uploads for account $accountName, stopping work")
return Result.success() return Result.success()
} }