<@UAYSNLD7T> an actor would be a fine approach if ...
# coroutines
@nwh an actor would be a fine approach if they need to be serially executed
By serially executed, do you mean sequentially? I'm not familiar with that term
yes, where every line of code in your actor lambda is executed as if it's single threaded
How would I stop execution if the actor is closed? Say, if one operation fails, is there some kind of mechanism for knowing I shouldn't perform the next one, or should I just use `return`s and such
@nwh The actor can have a parent
which you can cancel
@louiscad Does that mean I'll just have to pass around the
instance and check if it's cancelled?
@nwh it depends on how your operations are setup, how they report failure, and who is doing the cancelling. There are several options. If the actor is in control, you could just throw exceptions and catch them in the actor and then
, if you want to restart your loop)
if you want to cancel from outside the actor, you can use a job like Lous CAD said
@bj0 Yeah, not sure if the individual processes will be performing the cancellation or not. It's not a loop, it's several steps, and there is data being passed between each step
I think I'm probably over-complicating it
i mean the individual process can throw an exception and the actor can catch it and then decide to quit
or you could use return values, but it's a good use case for exceptions