v1.0.60: skip remote directories in sync + reduce concurrency to 2
Build & Release APK / build (push) Successful in 12m49s
Build & Release APK / build (push) Successful in 12m49s
- Filter out isDirectory entries from remoteFiles so remote folders are never treated as files to sync (fixes phantom-directory 'Partial ✗5' status) - Lower Semaphore from 4 → 2 to reduce concurrent SFTP sessions and avoid hitting server session limits
This commit is contained in:
@@ -77,6 +77,7 @@ class SyncEngine @Inject constructor(
|
|||||||
val accessor = makeAccessor(pair.localPath)
|
val accessor = makeAccessor(pair.localPath)
|
||||||
var knownStates = fileStateDao.getForPair(pair.id).associateBy { it.relativePath }
|
var knownStates = fileStateDao.getForPair(pair.id).associateBy { it.relativePath }
|
||||||
val remoteFiles = provider.listFiles(pair.remotePath).getOrThrow()
|
val remoteFiles = provider.listFiles(pair.remotePath).getOrThrow()
|
||||||
|
.filter { !it.isDirectory } // skip remote directories — they are not sync targets
|
||||||
.associateBy { it.path.removePrefix(pair.remotePath).trimStart('/') }
|
.associateBy { it.path.removePrefix(pair.remotePath).trimStart('/') }
|
||||||
val localFiles = accessor.walkFiles(pair)
|
val localFiles = accessor.walkFiles(pair)
|
||||||
|
|
||||||
@@ -93,7 +94,7 @@ class SyncEngine @Inject constructor(
|
|||||||
|
|
||||||
val allPaths = (localFiles.keys + remoteFiles.keys + knownStates.keys).toSet()
|
val allPaths = (localFiles.keys + remoteFiles.keys + knownStates.keys).toSet()
|
||||||
val hasPriorSyncState = knownStates.isNotEmpty()
|
val hasPriorSyncState = knownStates.isNotEmpty()
|
||||||
val semaphore = Semaphore(4)
|
val semaphore = Semaphore(2) // limit concurrency to be gentle on the server
|
||||||
val uploadedAtomic = AtomicInteger(0)
|
val uploadedAtomic = AtomicInteger(0)
|
||||||
val downloadedAtomic = AtomicInteger(0)
|
val downloadedAtomic = AtomicInteger(0)
|
||||||
val deletedAtomic = AtomicInteger(0)
|
val deletedAtomic = AtomicInteger(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user