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:
parent
4cc03a0036
commit
f0631f55b7
|
@ -17,6 +17,7 @@ import java.io.File
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
class MailReader(
|
class MailReader(
|
||||||
private val eInvoiceReader: EInvoiceReader = EInvoiceReader()
|
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()
|
private val log by logger()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue