Deprecation warning re. Sidekiq
tmaier opened this issue · comments
Brief Description
I have PromoteJob
set up as described at https://shrinerb.com/docs/plugins/backgrounding#setup
I am also using Sidekiq version 6.4.1
Sidekiq implemented with 6.4.0 "strict argument checking", see https://github.com/mperham/sidekiq/blob/main/Changes.md#640
PromoteJob
leads to a deprecation warning in my logs.
Expected behavior
Tell us what you expected to happen.
Should not raise this warnings - also to be able to be ready for Sidekiq 7.0.
Actual behavior
This leads to a warning in my logs:
Job arguments to PromoteJob do not serialize to JSON safely. This will raise an error in
Sidekiq 7.0. See https://github.com/mperham/sidekiq/wiki/Best-Practices or raise an error today
by calling `Sidekiq.strict_args!` during Sidekiq initialization.
Simplest self-contained example code to demonstrate issue
Please use PromoteJob
as described at https://shrinerb.com/docs/plugins/backgrounding#setup
System configuration
Ruby version: ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux-musl]
Shrine version: shrine (3.4.0)
Sidekiq version: sidekiq (6.4.1)
Odd, everything in the shrine example looks to me like it should serialize to JSON just fine. I wonder what part Sidekiq doesn't like.
It's probably because the attachment name
is a symbol, which is not serializable into JSON. I saw someone already updated the wiki page to pass it as a string.
@janko you are referring to here: https://github.com/shrinerb/shrine/wiki/Backgrounding-Libraries#sidekiq
The change was made by @patbenatar.
I tried it out.
The deprecation message seems to be gone.
I hope that the attacher also works with string names instead of symbols :)
Yes, the attacher converts given name into symbol. Sidekiq was still converting the symbol into a string before, but now it also prints out a warning.
shrine/lib/shrine/plugins/entity.rb
Line 99 in 4b6074c
Confirming that the change I made to the wiki has been working just fine for us