Fix for job_attributes with indifferent access. #205
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
I recently upgraded from v3.2.3 to v3.4.0 with my version of que remaining at v0.14.3 and ran into this issue #175
After doing some digging I discovered that the attrs hash on Que::Job can sometimes have indifferent access as seen below:
https://github.com/que-rb/que/blob/45e68691f2599c13b401e2d70cde6f6fbfcac708/lib/que/railtie.rb#L10
transform_keys(&:to_sym)
works with no issues, however when this hash is passed toHashie::Dash
throughcreating a new EnqueuedJobType it dies here:
https://github.com/hashie/hashie/blob/b24d6dca2c545637bc3cc3ac4d89f565fc27a9d0/lib/hashie/dash.rb#L199
As looping through the attributes uses the string keys which causes the error on
self[att]
.This commit will convert the HashWithIndifferentAccess to a standard hash leaving only sym keys at the end of the transform. Whilst being safe to regular hashes.