-
Notifications
You must be signed in to change notification settings - Fork 7
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
Reduce handler size in some ActiveJob cases, and fix deserialization inconsistency #24
Conversation
/no-platform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me! Only suggestion would be to add a test that explicitly makes sure we raise a NameError
and not a DeserializationError
in the circumstances described here #23
Dismissed because the approval didn't include a valid comment pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
domainLGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
domainLGTM!
This should address #23.
The issue here is that some ActiveJob-enqueued jobs would include the
@job
ivar in their serialized handler, which is redundant with@job_data
and only existed for memoization purposes. We can use Ruby'sencode_with
API to ensure that we only encode@job_data
into the handler.Including
@job
also had the side-effect of causingDeserializationErrors
and permanently failing jobs in cases where there would otherwise be a retryableNameError
. Whether a missing constant should result in aDeserializationError
is kind of a separate question, but sinceActiveJob
's stance seems to be to encode the class name as a string and only.constantize
it inside of the perform, I think that it's not surprising behavior to let theNameError
(and subsequent retries) occur.DeserializationError
is really supposed to be only for cases where we fundamentally can't even attempt the job and allow the normal pattern of exception-handling to occur.