https://kotlinlang.org logo
Title
p

Pablo

11/03/2020, 2:46 PM
If I have a multiple call with async await or launch if I don't want to fail if one fails I need to use supervisorScope or supervisorJob? What's the difference between them?
I know there's the supervisorJob that the child jobs inside can fail and it won't fail the parent one, but what's the difference with supervisorScope? When I can use it?
z

Zach Klippenstein (he/him) [MOD]

11/03/2020, 2:57 PM
a “supervisor scope” is just a
CoroutineScope
whose job is a
SupervisorJob
p

Pablo

11/03/2020, 2:59 PM
Is there any recomendation to use one or the other? I see the point, but I can also create a SupervisorJob and use a normal CoroutineScope, no?
z

Zach Klippenstein (he/him) [MOD]

11/03/2020, 3:19 PM
use whatever makes your code more readable