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
Hey!
Sometimes I have a task that Id like to run until completion, regardless if my workflow is still active at the end of it or not.
The task results in a T that my workflow shows to the user, if its still active. Do I just use withContext(NonCancellable) or is there a better way?
I guess the "ultimate" solution is to refactor the task to emit results to a Flow that my workflow observes while its active, and make the task itself execute in a scope outside of the workflow.. in my case this would be too much of a hassle to do, because I also need it to be a suspending function for another use-case.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey!
Sometimes I have a task that Id like to run until completion, regardless if my workflow is still active at the end of it or not.
The task results in a T that my workflow shows to the user, if its still active. Do I just use
withContext(NonCancellable)
or is there a better way?I guess the "ultimate" solution is to refactor the task to emit results to a Flow that my workflow observes while its active, and make the task itself execute in a scope outside of the workflow.. in my case this would be too much of a hassle to do, because I also need it to be a suspending function for another use-case.
Beta Was this translation helpful? Give feedback.
All reactions