Skip to content

Commit

Permalink
refactor: 调整默认调度器内部分配置
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed Sep 28, 2022
1 parent b31c2c5 commit c89cb65
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ private fun createDefaultDispatcher(
maxSize: Int?,
keepAliveTime: Long?,
): ExecutorCoroutineDispatcher {
// cpu-1 or 1
val coreSize0 = coreSize ?: (Runtime.getRuntime().availableProcessors() - 1).coerceAtLeast(0)
// cpu / 2 or 1
val coreSize0 = (coreSize ?: (Runtime.getRuntime().availableProcessors() / 2)).coerceAtLeast(1)
val maxSize0 = maxSize?.coerceAtLeast(coreSize0) ?: Int.MAX_VALUE
val keepAliveTime0 = keepAliveTime ?: 60_000 // ms -> 60s

Expand Down

0 comments on commit c89cb65

Please sign in to comment.