Using now a fixed size thread pool as otherwise as many threads get created as there are messages in the inbox which can be really a lot

This commit is contained in:
dankito 2024-11-21 23:13:56 +01:00
parent 4cc03a0036
commit f0631f55b7
1 changed files with 2 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import java.io.File
import java.time.Instant
import java.util.*
import java.util.concurrent.Executors
import kotlin.math.max
class MailReader(
private val eInvoiceReader: EInvoiceReader = EInvoiceReader()
@ -28,7 +29,7 @@ class MailReader(
)
private val mailDispatcher = Executors.newCachedThreadPool().asCoroutineDispatcher()
private val mailDispatcher = Executors.newFixedThreadPool(max(24, Runtime.getRuntime().availableProcessors() * 4)).asCoroutineDispatcher()
private val log by logger()