Make code better readable and add early exit if no folder is enabled

Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
This commit is contained in:
Jonas Mayer 2024-04-09 16:55:52 +02:00
parent b832c0a706
commit b121c21406

View file

@ -102,7 +102,12 @@ class FilesSyncWork(
// or sync worker already running and no changed files to be processed
val alreadyRunning = backgroundJobManager.bothFilesSyncJobsRunning()
if (alreadyRunning && changedFiles.isNullOrEmpty()) {
Log_OC.d(TAG, "Kill Sync Worker since another instance of the worker seems to be running already!")
Log_OC.d(TAG, "FILESYNC Kill Sync Worker since another instance of the worker seems to be running already!")
return true
}
if (! syncedFolderProvider.syncedFolders.any { it.isEnabled }){
Log_OC.d(TAG, "FILESYNC Kill Sync Worker since no sync folder is enabled!")
return true
}