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
I simply just break from the loop in my main Tokio process, and if I do await for the executor handle it will run forever which is not what I wanted after Ctrl+C. I wonder what is the best practice to deal with this.
I'm using the parallel feature and I think we will need a task abort mechanism which is likely one of these:
Cancellation token. For each spawned task in ctx, attach a global cancellation token, and when it was triggered, cancel all tasks.
Manually add a cancellation signal for each futures you spawned in ctx. This is similar to cancellation token although it is not mandatory
Use panic abort although this is more of a hail-marry approach (because you will lost valuable debug information for this)
Migrate the executor task to a specific thread, and stop accepting future works. I think this would be the most likely solution as it should be easily implementable.
The text was updated successfully, but these errors were encountered:
I am currently redesigning how futures are used in rquickjs in the PR #156.
With this redesign we no longer use tasks to schedule futures spawned by rquickjs.
I want to shutdown the executor when my script ends, but right now it doesn't seems like it is working.
Given that I have these error on Ctrl+C
It seems like the error comes from here:
rquickjs/core/src/runtime/async_executor.rs
Lines 106 to 113 in 234cc91
I simply just break from the loop in my main Tokio process, and if I do await for the executor handle it will run forever which is not what I wanted after Ctrl+C. I wonder what is the best practice to deal with this.
I'm using the
parallel
feature and I think we will need a task abort mechanism which is likely one of these:ctx
, attach a global cancellation token, and when it was triggered, cancel all tasks.ctx
. This is similar to cancellation token although it is not mandatoryThe text was updated successfully, but these errors were encountered: