Skip to content

Commit

Permalink
fix: always launch coroutines in IO (#50)
Browse files Browse the repository at this point in the history
* Change build in main job

* Refresh toggles and send metrics on IO scope
  • Loading branch information
gastonfournier authored Jul 19, 2024
1 parent 6ff3fd1 commit ff6abef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build main

on:
push:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ class DefaultUnleash(

override fun refreshTogglesNow() {
runBlocking {
fetcher?.refreshToggles()
withContext(Dispatchers.IO) {
fetcher?.refreshToggles()
}
}
}

Expand All @@ -225,7 +227,9 @@ class DefaultUnleash(
override fun sendMetricsNow() {
if (!unleashConfig.metricsStrategy.enabled) return
runBlocking {
metrics.sendMetrics()
withContext(Dispatchers.IO) {
metrics.sendMetrics()
}
}
}

Expand Down

0 comments on commit ff6abef

Please sign in to comment.