Stopping your tokio tasks like this might leave your program in a bad state.
Instead, try Tokio’s cancellation tokens.
Now you can run a proper shutdown procedure before terminating the task.
Such as flushing data to a file or database, or sending a shutdown message on a connection.
...
https://www.youtube.com/watch?v=uPwS6FLEs4Q