ixti/sidekiq-throttled

Does sidekiq-throttled works well with sidekiq-cron?

hubertjakubiak opened this issue · 1 comments

My configuration:

Sidekiq.configure_server do |config|
  config.redis = {
    url: "#{Rails.application.credentials.redis_url}/1"
  }
  Sidekiq::Cron::Job.load_from_array!(schedule)
end

Sidekiq.configure_client do |config|
  config.redis = {
    url: "#{Rails.application.credentials.redis_url}/1"
  }
end

Sidekiq::Throttled.setup!
Sidekiq::Throttled::Registry.add(:limited_concurrency, { concurrency: { limit: 10 } })

and error I'm getting:

bundle exec sidekiq
2020-10-08T08:06:36.720Z pid=9100 tid=oxmw2orlc INFO: Booting Sidekiq 6.1.2 with redis options {:url=>"redis://localhost:6379/1"}
2020-10-08T08:06:36.738Z pid=9100 tid=oxmw2orlc WARN: RuntimeError: Strategy not found: limited_concurrency
2020-10-08T08:06:36.738Z pid=9100 tid=oxmw2orlc WARN: /Users/hubertjakubiak/.rvm/gems/ruby-2.6.5/gems/sidekiq-throttled-0.13.0/lib/sidekiq/throttled/registry.rb:44:in `add_alias'

I moved line Sidekiq::Cron::Job.load_from_array!(schedule) to the end of file - Sidekiq::Cron::Job.load_from_array(schedule) if Sidekiq.server? and it works.