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
The cleanup_task does not run when flow is interrupted by Ctrl+C.
This is problematic when using cargo watch (or similar).
Exemple:
Imagine we are developing a web server with actix-web. We need a redis database to store some data.
We want to setup the environment before runing cargo watch and clean up the environment when we interupt the watch.
@SomaticIT sorry for late reply.
i totally get your use case, but i feel its not something standard for scripts to do. usually the signal would kill the process.
maybe you need to cleanup any previous leftovers before the execution?
However, it's not uncommon to see scripts that react to the SIGINT signal to clean their ressources.
eg: telepresence clean remote ressources on k8s and close the connection
eg2: actix-web clean all workers to avoid zombies
To clarify a good use case for this feature, it would be useful to start some containers before running the dev server and stopping/cleaning these containers when killing the server.
Maybe to avoid ambiguities, we could add an option (eg : cleanup_on_sigint: true or on_sigint: "task_name").
What do you think?
there is some unstable feature for singal handling which kills child process and might be a good start for reusing for this issue.
would you like to investigate a solution with my help and publish a PR? or prefer for me to look at it?
heads up, it won't be trivial.
Describe The Bug
The
cleanup_task
does not run when flow is interrupted byCtrl+C
.This is problematic when using
cargo watch
(or similar).Exemple:
Imagine we are developing a web server with
actix-web
. We need aredis
database to store some data.We want to setup the environment before runing
cargo watch
and clean up the environment when we interupt the watch.To Reproduce
1/ Setup
Makefile.toml
2/ Run
cargo make dev
3/
Ctrl+C
The task
cleanup
is never executed.Error Stack
None.
The text was updated successfully, but these errors were encountered: