Skip to content

After using Actor::kill, is it still necessary to call JoinHandle.await? #174

Answered by slawlor
phil-skillwon asked this question in Q&A
Discussion options

You must be logged in to vote

You should await the joinhandle ideally, it'll interrupt the messaging task under the hood, however there is some non-instant cleanup which needs to execute for the actor to fully die. If you don't await the handle, and immediately exit, you may have a form of memory-leak because tokio will have some pending tasks living around.

You generally don't need to wait on the handles if you're not immediately shutting down however, so in "general" you just do it on the root-process inside the main of your process to not exit the process too quickly.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by phil-skillwon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants