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

Exception handling for `on_worker_boot` #1551

Closed
austinthecoder opened this issue Mar 29, 2018 · 1 comment
Closed

Exception handling for `on_worker_boot` #1551

austinthecoder opened this issue Mar 29, 2018 · 1 comment

Comments

@austinthecoder
Copy link

@austinthecoder austinthecoder commented Mar 29, 2018

When an exception is raised in on_worker_boot, it will retry ad infinitum. I suppose there are situations when this is a good thing. E.g., a db instance is rebooting and a connection can't be made for a few seconds.

What's the best way to handle exceptions that should halt the server? How do you actually halt the server in this case?

on_worker_boot do
  raise 'error'
end

I'm sorry if this is not the place for this question. I couldn't find a general discussion board.

@nateberkopec nateberkopec added feature and removed question labels Oct 4, 2019
@nateberkopec
Copy link
Member

@nateberkopec nateberkopec commented Oct 4, 2019

I've thought about this and I think this is actually a Bad Thing. If any hook (e.g. anything run by run_hooks) raises an exception we should rescue it, log and notify that the hook was not run successfully. Essentially run_hooks should just rescue and log everything.

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

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.