From 3a85c4d680d77f93f80becf2f2f9e8e0381b05a4 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 4 Feb 2022 17:22:39 +0000 Subject: [PATCH] DEV: Ensure Sidekiq job arguments have stringified keys The latest version of Sidekiq introduced a warning when jobs are queued with arguments which 'do not stringify to JSON safely'. In the vast majority of cases, this is because a hash is passed with symbols as keys. When those args are passed to the job, the keys will be stringified. Our job wrapper already takes care of this issue by calling '.with_indifferent_access' on the args before passing them to `#execute`, so we don't need to change anything about our use. All we need to do is satisfy Sidekiq's warning system by 'stringifying' all the keys before enqueuing the job. --- app/jobs/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/base.rb b/app/jobs/base.rb index fdcd1dd55e..180adbe086 100644 --- a/app/jobs/base.rb +++ b/app/jobs/base.rb @@ -298,7 +298,7 @@ module Jobs if ::Jobs.run_later? hash = { 'class' => klass, - 'args' => [opts] + 'args' => [opts.deep_stringify_keys] } if delay = opts.delete(:delay_for)