mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Fix to many returns in doWork
Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
This commit is contained in:
parent
24b1fa2da7
commit
575e413b8d
1 changed files with 6 additions and 6 deletions
|
@ -94,15 +94,15 @@ class FilesSyncWork(
|
|||
|
||||
@Suppress("MagicNumber")
|
||||
override fun doWork(): Result {
|
||||
if (backgroundJobManager.bothFilesSyncJobsRunning()) {
|
||||
Log_OC.d(TAG, "Kill Sync Worker since another instance of the worker seems to be running already!")
|
||||
return Result.success()
|
||||
}
|
||||
backgroundJobManager.logStartOfWorker(BackgroundJobManagerImpl.formatClassTag(this::class))
|
||||
|
||||
// If we are in power save mode or sync worker already running, better to postpone upload
|
||||
val overridePowerSaving = inputData.getBoolean(OVERRIDE_POWER_SAVING, false)
|
||||
// If we are in power save mode, better to postpone upload
|
||||
if (powerManagementService.isPowerSavingEnabled && !overridePowerSaving) {
|
||||
val alreadyRunning = backgroundJobManager.bothFilesSyncJobsRunning()
|
||||
if ((powerManagementService.isPowerSavingEnabled && !overridePowerSaving) || alreadyRunning) {
|
||||
if (alreadyRunning) {
|
||||
Log_OC.d(TAG, "Kill Sync Worker since another instance of the worker seems to be running already!")
|
||||
}
|
||||
val result = Result.success()
|
||||
backgroundJobManager.logEndOfWorker(BackgroundJobManagerImpl.formatClassTag(this::class), result)
|
||||
return result
|
||||
|
|
Loading…
Reference in a new issue