Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how clean works in the actor _run() method #17

Open
llucax opened this issue Mar 26, 2024 · 2 comments
Open

Clarify how clean works in the actor _run() method #17

llucax opened this issue Mar 26, 2024 · 2 comments

Comments

@llucax
Copy link
Contributor

llucax commented Mar 26, 2024

It took me a while to think about the different scenarios to conclude calling cancel only when CancelledError is raised. Just to confirm my thinking is correct, you do this because if any other unexpected exception is raised and _run() is aborted, the auto-restart for actors will kick-in and meanwhile, any task that it is still healthy, will continue working, so hopefully ready dispatches will still be delivered on time, even if the actor wasn't restarted yet?

If this is the case, maybe you should check tasks health when _fetch()ing too, in case some task was aborted, to try to restart it. Right now you are only checking if a task is in the _scheduled dict, but not if the tasks are still running or not.

In any case, it is probably worth adding a comment here clarifying how clean up works exactly on different scenarios.

Originally posted by @llucax in #9 (comment)

@llucax llucax mentioned this issue Mar 26, 2024
@Marenz
Copy link
Contributor

Marenz commented Mar 27, 2024

I think I was too set on the whole "be have correct on normal termination" mindset that I forgot abnormal termination.
So I suppose the proper way would be to cancel all for any unresolvable exception.. which is what I would expect to happen as a user, too

@llucax
Copy link
Contributor Author

llucax commented Mar 28, 2024

Please bear in mind that the actor will be restarted, so as a user you shouldn't really notice it, maybe only in the logs. As a user you just need to make sure the actor is properly restarted on unexpected errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants