Trey
04/27/2022, 2:16 PMAdam Powell
04/27/2022, 2:38 PMThrowable
and not rethrowing is likely breaking cancellationAdam Powell
04/27/2022, 2:39 PMTrey
04/27/2022, 2:42 PMAdam Powell
04/27/2022, 2:44 PMAdam Powell
04/27/2022, 2:45 PMAdam Powell
04/27/2022, 2:45 PMTrey
04/27/2022, 2:48 PMjulian
04/27/2022, 6:07 PMasync
when you do nothing with the Deferred
returned?
Also, if you're interested in just one value from userState
, and it's a Flow
why not just take(1)
, instead of wrapping in collect
? Also, as is, viewModelScope.launch
and viewModelScope.async
will run concurrently. Wouldn't you prefer the inner coroutine to be a child of the outer one? That way cancelling the job of the outer one would automatically cascade down to cancel the inner one?Trey
04/27/2022, 6:13 PMjulian
04/27/2022, 6:29 PMviewModelScope
itself, which is a SupervisorJob
. I don't see how that could have completed if onCleared
was never called.
Are there any other parent-child job relationships in play that we can't see from the code given?
The exception suggests that you're trying to do something with a job whose parent has completed. Question is... which parent job is that?julian
04/27/2022, 6:30 PMviewModelScope
that doesn't use a SupervisorJob
?Trey
04/27/2022, 6:59 PMjulian
04/27/2022, 7:07 PMcollect
called before the exception occurs?Trey
04/27/2022, 7:39 PMjulian
04/27/2022, 9:56 PMwebService
is still connecting when disconnect
is called? If so, how does webService
behave in this situation? I assume connect
and disconnect
are not suspend
functions. Is that right?Trey
04/27/2022, 10:29 PM