refactor: 不再固定生成 50 大小的 Queue, 而是根据 threadNum 决定.

This commit is contained in:
LamGC 2024-03-25 22:03:34 +08:00
parent 376113a0b6
commit 8b76c3e023
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -268,7 +268,7 @@ class OneDriveTransferTaskExecutor(
private val chunkSize: Int = 26 private val chunkSize: Int = 26
) : ThreadPoolExecutor( ) : ThreadPoolExecutor(
threadNum, threadNum, 0, TimeUnit.SECONDS, threadNum, threadNum, 0, TimeUnit.SECONDS,
ArrayBlockingQueue(50), ArrayBlockingQueue(threadNum * 2),
ThreadFactoryBuilder() ThreadFactoryBuilder()
.setNameFormat("Transfer Worker %d") .setNameFormat("Transfer Worker %d")
.build() .build()