Skip to content

Commit

Permalink
execute indicator.getDetails with an IO Dispatcher because the status…
Browse files Browse the repository at this point in the history
… detail indicators may use blocking code
  • Loading branch information
frankbregulla1111 committed Jul 17, 2024
1 parent 0dd001c commit 1d492ec
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import de.otto.babbage.core.status.indicators.Status.*
import de.otto.babbage.core.status.indicators.StatusDetail
import de.otto.babbage.core.status.indicators.StatusDetailIndicator
import de.otto.babbage.core.status.version.GitVersionProvider
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.http.MediaType
Expand Down Expand Up @@ -36,7 +38,7 @@ class StatusController(
@ResponseBody
suspend fun statusJson(): StatusData {
val indicators = statusDetailIndicators.groupBy { it.getGroup() }
.map { it.key to it.value.flatMap { indicator -> indicator.getDetails() } }
.map { it.key to it.value.flatMap { indicator -> withContext(Dispatchers.IO) { indicator.getDetails() } } }
.toMap()
return StatusData(
application = Application(
Expand Down

0 comments on commit 1d492ec

Please sign in to comment.