Skip to content

Commit 1d492ec

Browse files
execute indicator.getDetails with an IO Dispatcher because the status detail indicators may use blocking code
1 parent 0dd001c commit 1d492ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/kotlin/de/otto/babbage/core/status/StatusController.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import de.otto.babbage.core.status.indicators.Status.*
77
import de.otto.babbage.core.status.indicators.StatusDetail
88
import de.otto.babbage.core.status.indicators.StatusDetailIndicator
99
import de.otto.babbage.core.status.version.GitVersionProvider
10+
import kotlinx.coroutines.Dispatchers
11+
import kotlinx.coroutines.withContext
1012
import org.springframework.beans.factory.annotation.Autowired
1113
import org.springframework.beans.factory.annotation.Value
1214
import org.springframework.http.MediaType
@@ -36,7 +38,7 @@ class StatusController(
3638
@ResponseBody
3739
suspend fun statusJson(): StatusData {
3840
val indicators = statusDetailIndicators.groupBy { it.getGroup() }
39-
.map { it.key to it.value.flatMap { indicator -> indicator.getDetails() } }
41+
.map { it.key to it.value.flatMap { indicator -> withContext(Dispatchers.IO) { indicator.getDetails() } } }
4042
.toMap()
4143
return StatusData(
4244
application = Application(

0 commit comments

Comments
 (0)