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

Trigger some code when worker times out or is killed #88

Open
geoffroymontel opened this issue Mar 16, 2015 · 3 comments
Open

Trigger some code when worker times out or is killed #88

geoffroymontel opened this issue Mar 16, 2015 · 3 comments

Comments

@geoffroymontel
Copy link

Hi there

I'm using backburner:threads_on_fork:work in production and I'd like some code on my workers to be run when the worker times out or is killed.

I enclosed my worker code in a begin/rescue

    begin
      # do time consuming thing
    rescue => e
      Rails.logger.error("There was an error = #{e} ")
      myModel.update_attributes(state: "error")
      raise e
    end

but it seems the code in rescue is never called.

Any hint ?

Thanks in advance

geoffroy

@contentfree
Copy link
Collaborator

@geoffroymontel Once 1.1 goes out (today?) you'll be able to add hooks for on_retry and on_bury. Will those be sufficient?

@geoffroymontel
Copy link
Author

@contentfree I don't think these hooks will be triggered when the worker is killed but I will try the new version and keep you updated. Thanks !

@contentfree
Copy link
Collaborator

contentfree commented Sep 15, 2015 via email

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