Closed popcorn closed 1 year ago
TLDR; You should not wrap throttle config in {}
:
class SyncSubscriber
include Sidekiq::Worker
include Sidekiq::Throttled::Worker
sidekiq_options queue: 'priority'
sidekiq_throttle threshold: {
limit: 5,
period: 1.second,
key_suffix: ->(sub_id) { sub_id }
}
def perform(sub_id)
# Do the sync
end
end
Need to update README.
As of Ruby 3.x.x foo({ abc: 123 })
is sending :foo
message with given Hash as a single argument and does not tries to map given Hash to keyword arguments:
def foo(x: 123); end
foo({ x: 123 }) # will fail in Ruby 3.0.0+
# In Ruby 3.0.0+ you should do:
foo(x: 123)
I'm upgrading Ruby to 3.0.1 and
sidekiq-throttle
fails with the following error:It is the same error I would get when not using a different number of arguments for
key_suffix
andperform
.This is the worker class and it works with Ruby 2.5 (code is redacted for brevity's sake)
Anyone had this problem?