Skip to content

Commit

Permalink
Add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hs-arodrigues committed Mar 28, 2024
1 parent 96c2708 commit e694fc6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/que/job_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ module JobMethods
# overriding the args, because it's necessary when jobs are invoked from
# ActiveJob.
def _run(args: nil, kwargs: nil, reraise_errors: false)
Que.log(
level: :debug,
event: :entering_run,
job_id: que_target.que_attrs[:id],
message: 'Entering _run',
)

if args.nil? && que_target
args = que_target.que_attrs.fetch(:args)
end
Expand All @@ -48,9 +55,23 @@ def _run(args: nil, kwargs: nil, reraise_errors: false)
kwargs = que_target.que_attrs.fetch(:kwargs)
end

Que.log(
level: :debug,
event: :run_args,
job_id: que_target.que_attrs[:id],
args: args,
kwargs: kwargs,
)

run(*args, **kwargs)
default_resolve_action if que_target && !que_target.que_resolved
rescue => error
Que.log(
level: log_level(error),
event: :job_errored,
job_id: que_target.que_attrs[:id],
error: "#{error.class}: #{error.message}".slice(0, 500),
)
raise error unless que_target

que_target.que_error = error
Expand Down

0 comments on commit e694fc6

Please sign in to comment.