Suppressed errors when starting/stopping an endpoint VERY quickly (as usually done in unit tests). These warnings, while noramlly VERY important, can be safely ignored.

This commit is contained in:
Robinson 2021-04-29 09:59:42 +02:00
parent 841b9959ac
commit f5ab178948

View File

@ -20,6 +20,7 @@ import kotlinx.atomicfu.atomic
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.ClosedSendChannelException
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import mu.KLogger
@ -71,8 +72,12 @@ internal class ResponseManager(private val logger: KLogger, private val actionDi
// populate the array of randomly assigned ID's + waiters. This can happen in a new thread
actionDispatch.launch {
for (it in ids) {
waiterCache.offer(ResponseWaiter(it))
try {
for (it in ids) {
waiterCache.offer(ResponseWaiter(it))
}
} catch (e: ClosedSendChannelException) {
// this can happen if we are starting/stopping an endpoint (and thus a response-manager) VERY quickly, and can be ignored
}
}
}