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

Create InterruptErrors extension to raise an exception when an interrupted job is retried #830

Merged
merged 2 commits into from
Feb 7, 2023

Conversation

bensheldon
Copy link
Owner

Connects to #821

@bensheldon bensheldon temporarily deployed to goodjob-interrupt-error-8f8oeg February 6, 2023 23:09 Inactive
@bensheldon
Copy link
Owner Author

@TAGraves for your review.

fyi, @jrochkind too because this is sort of related to #794

Copy link
Contributor

@TAGraves TAGraves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 This is going to be a huge help for us!

README.md Outdated Show resolved Hide resolved
@bensheldon bensheldon temporarily deployed to goodjob-interrupt-error-8f8oeg February 7, 2023 04:57 Inactive
@bensheldon bensheldon marked this pull request as ready for review February 7, 2023 05:11
@bensheldon bensheldon merged commit a44a464 into main Feb 7, 2023
@bensheldon bensheldon deleted the interrupt-error branch February 7, 2023 05:11
@bensheldon
Copy link
Owner Author

@jrochkind
Copy link
Contributor

Thanks for the tag. I don't entirely understand what's going on, but seems good...

Jobs will be automatically retried if the process is interrupted while performing a job, for example as the result of a SIGKILL or power failure.

Wait... is that a NEW feature? I thought that was always a feature of good_job from the start? No?

@bensheldon
Copy link
Owner Author

@jrochkind whoops, "will be" is just poor language on my part. It's "Jobs are automatically retried" which is how it's always been.

#794 would log interrupted jobs that had been forcibly shutdown. This PR will, when those jobs are retried, provide some control over how they are executed (e.g. discard them rather than retry).

@jrochkind
Copy link
Contributor

Thanks! Sounds good!

@bensheldon bensheldon added the enhancement New feature or request label Feb 9, 2023
Comment on lines +8 to +12
around_perform do |_job, block|
raise InterruptError, "Interrupted after starting perform at '#{CurrentThread.execution_interrupted}'" if CurrentThread.execution_interrupted.present?

block.call
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this override/be overridden by any around_perform i have in my application_job.rb?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

4 participants