You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
launchIn is a convenient shortcut, but can't be used if a start parameter of launch needs to be provided.
Shall we add an optional start to launchIn? I was wondering why not and why it is not already there.
My use case (probably similar to this):
I am not advanced user and trying to stay away from Unconfined and Undispatched, but I guess I am finally in a situation where I should use the latter.
I have a hot source which currently is still reactor Flux (not yet migrated to flow), let's call it flux.
Here action indirectly modifies the source flux. I need to be sure that by the time action is called subscription to source flux has happened and no emissions are lost between launch and action.
Do I understand correctly that I just need to launchIn(scope, start = CoroutineStart.UNDISPATCHED) to be safe?
The text was updated successfully, but these errors were encountered:
Yes, UNDISPATHCED would do the trick as long as you don't have any non-trivial operators in between, e.g. buffer that actually launches a separate coroutine for flow collection.
Thanks for the use-case! I will close this as a duplicate of #1326, but will reconsider its status, keeping additional demand on it in mind
launchIn
is a convenient shortcut, but can't be used if astart
parameter oflaunch
needs to be provided.Shall we add an optional
start
tolaunchIn
? I was wondering why not and why it is not already there.My use case (probably similar to this):
I am not advanced user and trying to stay away from
Unconfined
andUndispatched
, but I guess I am finally in a situation where I should use the latter.I have a hot source which currently is still reactor
Flux
(not yet migrated to flow), let's call itflux
.flux() .asFlow() .onEach { ... } .launchIn(scope) action()
Here
action
indirectly modifies the sourceflux
. I need to be sure that by the timeaction
is called subscription to source flux has happened and no emissions are lost betweenlaunch
andaction
.Do I understand correctly that I just need to
launchIn(scope, start = CoroutineStart.UNDISPATCHED
) to be safe?The text was updated successfully, but these errors were encountered: