Skip to content

Commit

Permalink
Restrict Checker.concurrencyLimit to 3 when backend requires network
Browse files Browse the repository at this point in the history
  • Loading branch information
grote committed Oct 29, 2024
1 parent 6344785 commit 4cb418e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class BackendManager(
return mBackendProperties
}
val isOnRemovableDrive: Boolean get() = backendProperties?.isUsb == true
val requiresNetwork: Boolean get() = backendProperties?.requiresNetwork == true

init {
when (settingsManager.storagePluginType) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/stevesoltys/seedvault/repo/Checker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ internal class Checker(
private var snapshots: List<Snapshot>? = null
private val concurrencyLimit: Int
get() {
// TODO determine also based on backendManager
return Runtime.getRuntime().availableProcessors()
val maxConcurrent = if (backendManager.requiresNetwork) 3 else 42
return min(Runtime.getRuntime().availableProcessors(), maxConcurrent)
}
var checkerResult: CheckerResult? = null
private set
Expand Down

0 comments on commit 4cb418e

Please sign in to comment.