Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify key to limit on #2

Closed
jnylen opened this issue Dec 6, 2015 · 5 comments
Closed

Specify key to limit on #2

jnylen opened this issue Dec 6, 2015 · 5 comments
Labels

Comments

@jnylen
Copy link

jnylen commented Dec 6, 2015

Hi!
Is it possible for you to look into a way to specify what key to throttle it on?

At the moment i'm using Sidekiq-throttler which does it via:
sidekiq_options throttle: { threshold: 20, period: 1.minute, key: 'tvdb' }

@ixti ixti self-assigned this Dec 7, 2015
@ixti
Copy link
Owner

ixti commented Dec 7, 2015

There's a way to create "shared" strategies:

# config/initializers/sidekiq-throttled.rb
Sidekiq::Throttled::Registry.add(:tvdb, {
  :threshold => { :limit => 20, :period => 1.minute }
})

# app/jobs/latest_updates_worker.rb
class LatestUpdatesWorker
  include Sidekiq::Worker
  include Sidekiq::Throttled::Worker

  sidekiq_throttle_as :tvdb

  # ...
end

@badlamer
Copy link

And ability to be a key lambda from job args

@ixti
Copy link
Owner

ixti commented Dec 10, 2015

Dynamic configuration (key/limit/period) is not available ATM.
But I'm pretty open to add it.

@ixti ixti added the question label Dec 10, 2015
@ixti ixti removed their assignment Dec 10, 2015
@ixti
Copy link
Owner

ixti commented Dec 10, 2015

I have created separate issue ( #4 ) to discuss dynamic options.
I dislike the way they are usually done, so wanna try to find the best approach.
Feel free to express your thoughts! :D

@jnylen
Copy link
Author

jnylen commented Dec 13, 2015

As it's already a way to specific keys. Then I guess my question got answered. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants