mirror of
https://github.com/plashchynski/crono.git
synced 2026-01-12 05:20:26 +01:00
Use perform_now instead of perform #41
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @NeilBetham on GitHub (Feb 24, 2017).
Would it be possible to use ActiveJob's
peform_nowinstead ofperform? The main reason I ask is that usingpeform_nowwill call all of the ActiveJob callbacks and error handlers. The error handler callback is particularly important for reporting problems to a error reporting system like Sentry. Is there a reasonperformwas used instead ofperform_now?@MohamedBassem commented on GitHub (May 2, 2017):
Yes please. I spent 2 hours trying to find why job failures doesn't trigger airbrake notifications until I found that the
rescue_fromof the ActiveJob is not triggered becauseJob.new.performis used instead ofperform_now.@edwardmp commented on GitHub (Aug 8, 2017):
I agree. Is there any reason perform is used because of perform_now?
@edwardmp commented on GitHub (Aug 8, 2017):
As a workaround you can do something like this:
But I agree it would be better if perform_now is called by default
Edit: in my case, this still doesn't report the error to Rollbar. It seems Crono catches the error elsewhere:
5b72e08222/lib/crono/job.rb (L81)so you would need to monkey patch the
handle_job_failmethod to get this to work.@sina-s commented on GitHub (Sep 8, 2018):
I have the exact same use-case, reporting errors to Sentry. I came up with another work around that doesn't need monkey patching Crono. Assuming your jobs are subclass of
ApplicationJob, define yourperforminsideApplicationJoband change theperformmethod name to something else (in my caseperform!) in your job class. Not sure how graceful this work around is, as it requires to change all of your job classes.