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

Fix for job_attributes with indifferent access. #205

Merged
merged 1 commit into from
Jul 11, 2020

Conversation

redscode
Copy link
Contributor

@redscode redscode commented Jul 8, 2020

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 to Hashie::Dash through
creating 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.

@hlascelles
Copy link
Owner

Good sleuthing, thank you for this. I'll formalise a test for it and get it merged as soon as I can.

@hlascelles
Copy link
Owner

PR with tests for the above created: #206

@hlascelles
Copy link
Owner

Gem 3.4.1 released.

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.

2 participants