Skip to content

Commit

Permalink
Prevent possible IllegalArgumentException
Browse files Browse the repository at this point in the history
The "serverConfig.maxSourcesInParallel" value could have changed after the if-condition
  • Loading branch information
schroda committed Sep 25, 2024
1 parent 14b03b9 commit bd6757f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ object DownloadManager {
.distinct()
.minus(
runningDownloaders.map { it.sourceId }.toSet(),
).take(serverConfig.maxSourcesInParallel.value - runningDownloaders.size)
).take((serverConfig.maxSourcesInParallel.value - runningDownloaders.size).coerceAtLeast(0))
.map { getDownloader(it) }
.forEach {
it.start()
Expand Down

0 comments on commit bd6757f

Please sign in to comment.