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

Stringify money BigDecimal value in Active Job serializer #253

Merged
merged 1 commit into from Jan 20, 2023
Merged

Stringify money BigDecimal value in Active Job serializer #253

merged 1 commit into from Jan 20, 2023

Conversation

bdewater-thatch
Copy link
Contributor

Sidekiq 7.0 by default enforces that values must be JSON safe: https://github.com/mperham/sidekiq/blob/v7.0.0/lib/sidekiq/job_util.rb#L68 (see sidekiq/sidekiq#5071) i.e. before and after a serialization roundtrip be exactly the same.

Before this fix ActiveJob enqueues a BigDecimal, which eventually does end up in the same string representation thanks to Active Support's extension: https://guides.rubyonrails.org/v7.0.0/active_support_core_extensions.html#extensions-to-bigdecimal with thix fix we do the same explicitly to make Sidekiq happy.

Since Money can handle well-formed string values there are no forwards or backwards compatibility problems.

Sidekiq 7.0 by default enforces that values must be JSON safe: https://github.com/mperham/sidekiq/blob/v7.0.0/lib/sidekiq/job_util.rb#L68
i.e. before and after a serialization roundtrip be exactly the same.

Before this fix ActiveJob enqueues a BigDecimal, which eventually does end up in the same string representation thanks to Active Support's extension: https://guides.rubyonrails.org/v7.0.0/active_support_core_extensions.html#extensions-to-bigdecimal
with thix fix we do the same explicitly to make Sidekiq happy.

Since Money can handle well-formed string values there are no forwards or backwards compatibility problems.
@elfassy elfassy merged commit bae448a into Shopify:master Jan 20, 2023
@bdewater-thatch bdewater-thatch deleted the fix-money-serializer-sidekiq branch January 20, 2023 17:28
@shopify-shipit shopify-shipit bot temporarily deployed to production January 24, 2023 13:39 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to production June 21, 2023 20:43 Inactive
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.

None yet

3 participants