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

Add support for DelayedJob Custom Job arguments #359

Conversation

calvinhughes
Copy link
Contributor

This adds support for passing the arguments for Custom Job objects in the DelayedJob integration.

Please advise of the best way to handle writing any specs for this. I've tested it manually on various job types.

@@ -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?

@Cawllec Cawllec merged commit 6bc3ab1 into bugsnag:master Dec 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants