-
-
Notifications
You must be signed in to change notification settings - Fork 204
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_executions not counted correctly? #215
Comments
@Timmitry Great question! I think you're experiencing the default behavior:
You can change this either by:
Please take a look at this section in the Readme. Any ideas on how to better document/explain this behavior? |
Hey @bensheldon, thanks for the quick answer - I'll be glad to help improve the documentation, but first, some more questions 🙂 Let's start with the following setup for a dummy job: # initializer
GoodJob.on_thread_error = ->(exception) do
binding.pry
Raven.capture_exception(exception)
end
GoodJob.preserve_job_records = true
# dummy_job.rb
class DummyJob < ApplicationJob
around_perform do |_job, block|
block.call
rescue StandardError => e
Raven.capture_exception(e)
binding.pry # around_perform
raise
end
retry_on KeyError, wait: 1.second, attempts: 3 do |_job, _exception|
binding.pry # retry_on
raise _exception
end
def perform
binding.pry # perform
{}.fetch(:foo)
end
end Now, if I enqueue one dummy job, I'll hit the binding.pry breakpoints in the following order: perform -> around_perform (Execution 1) And from now on, it always goes like this, in a seemingly infinite loop (at least until If i call The It seems like GoodJob does infinite retries when not having set Maybe you can shed some light on this behaviour? Overall, my current thinking would be that |
@Timmitry I'll dig more into the examples you gave. I just wanted to respond to this:
I largely agree with that. But as a default, I am opinionated that GoodJob should preserve jobs on unhandled exceptions. This is true especially if someone is migrating from another job adapter and likely is not using ActiveJob for error handling at the time they may swap-in GoodJob. Safe by default, is my opinion here, even if it's a bit rough. |
Thanks for documenting all of these things. There's a lot to cover, so let me know if you want me to dive deeper into something:
|
@Timmitry I am going to close this issue because I believe all of the problems have either been addressed or have targetted issues. |
Hello, and thank you for this great gem! I'm using it for the first time, but am already very satisfied, as the integration with ActiveJob feels very good 👌
I was just testing my application in production. I have a clockwork process which enqueues a
DummyJob
, which is then being executed by a separate good_job-process. The dummy job looks like this:E.g. it fails randomly with a key error, and is retried up to 3 times (for this error).
Now I was watching the good_job dashboard, and saw the three executions of the job (newest first):
As you can see, the
executions
go from 0 to 2, which seems correct. Theexception_executions
forKeyError
, however, go from 1 to 2 to 12? For the next dummy job, which was also retried 3 times, I had 1, 2, and 20.I'm not sure if I misunderstand some behaviour, or if this might be an ActiveJob bug, but I thought I'd ask here first.
Thank you!
The text was updated successfully, but these errors were encountered: