I want to cancel a
Process.sleep task I spawned before it resolves and sends a message back to the update function.
I asked googled a lot, tried my own code, and asked in slack, and couldn’t find a way to do it with Tasks and Process.
Is this possible?
- First try: https://ellie-app.com/5zqtzfQMRZxa1
- Failure, since that seems to perform two different tasks even if they are the same instance, so when cancelling it only cancels the spawned one but it still times out
- Another try, by @szubtsovskiy: https://ellie-app.com/5zqF55LKc92a1
- Fail as well, as it cancels properly, but the timeout never triggers the message back to the update function (I guess it happens in the process separately, not doing anything useful)
So finally: Is there a way to cancel a timer? It is fine if the answer is no!
Please focus on the question and code, thank you. I think I do know how to ignore message results in
update by attaching unique ids to the timeouts for example, as well as other techniques. That is not what this question is about. Thank you!