Skip to content

Commit da31eae

Browse files
committed
Launch coroutines concurrently from the main thread as described initially in the tutorial
1 parent 2f678ed commit da31eae

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/contributors/Contributors.kt

+2-4
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,9 @@ interface Contributors: CoroutineScope {
7979
}.setUpCancellation()
8080
}
8181
CONCURRENT -> { // Performing requests concurrently
82-
launch(Dispatchers.Default) {
82+
launch {
8383
val users = loadContributorsConcurrent(service, req)
84-
withContext(Dispatchers.Main) {
85-
updateResults(users, startTime)
86-
}
84+
updateResults(users, startTime)
8785
}.setUpCancellation()
8886
}
8987
NOT_CANCELLABLE -> { // Performing requests in a non-cancellable way

0 commit comments

Comments
 (0)