Skip to content

Add support for DelayedJob Custom Job arguments #359

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

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/bugsnag/delayed_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def error(job, error)
p[:id] = payload.id if payload.respond_to?(:id)
p[:display_name] = payload.display_name if payload.respond_to?(:display_name)
p[:method_name] = payload.method_name if payload.respond_to?(:method_name)
p[:args] = payload.args if payload.respond_to?(:args)
p[:args] = payload.respond_to?(:args) ? payload.args : payload.to_h
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does to_h come from? I didn't see this mentioned in DelayedJob anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kattrali It's available as a method on the Struct class which is passed to Delayed::Job#enqueue. This outputs the parameters to that job in the form of a hash.

However I can see it might raise problems where the user has a Custom class that does not support this method, so I'll update it to not add args in such case. What do you think?


if payload.is_a?(::Delayed::PerformableMethod) && (object = payload.object)
p[:object] = {
:class => object.class.name,
Expand Down