Skip to content

Commit

Permalink
chore: resolve sidekiq json-unsafe warning
Browse files Browse the repository at this point in the history
Sidekiq 6.4 has started to log warnings
(sidekiq/sidekiq#5071) if the job arguments are
not strictly JSON-safe i.e. serializing to JSON and deserializing from
JSON yield consistent outputs. To what it means, we cannot use a hash
with symbol keys since doing the JSON rountrip will change them all to
string keys.

This fix will transform the hash argument with symbol keys to string
keys so Sidekiq won't complain it (and break it starting version 7.0).
  • Loading branch information
QQism committed Mar 5, 2022
1 parent a3c098b commit 3e241af
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -7,7 +7,7 @@ def initialize(serializer:)
end

def call(klass, record)
klass.perform_async(record.serialize(serializer).to_h)
klass.perform_async(record.serialize(serializer).to_h.transform_keys!(&:to_s))
end

def verify(subscriber)
Expand Down

0 comments on commit 3e241af

Please sign in to comment.