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

Can I use multiple thresholds in the same worker? #20

Open
jay-snee opened this issue Aug 31, 2014 · 4 comments
Open

Can I use multiple thresholds in the same worker? #20

jay-snee opened this issue Aug 31, 2014 · 4 comments

Comments

@jay-snee
Copy link

For example, Amazon SES initially limits sends to 5 per second, 10000 per day. Can I add multiple thresholds like so:

sidekiq_options throttle: { threshold: 5, period: 1.second }
sidekiq_options throttle: { threshold: 10000, period: 24.hours }

@rahilsondhi
Copy link

I'm interested in this as well.

I have a worker talking to an external API. I have throttle: { threshold: 5000, period: 1.hour }, but I don't want to send more than one request per second, so I also want throttle: { threshold: 1, period: 1.second }

EDIT: This seems to be related to this TODO https://github.com/gevans/sidekiq-throttler/blob/master/lib/sidekiq/throttler/rate_limit.rb#L6 from @gevans

@dmitry
Copy link

dmitry commented Dec 16, 2014

@rahilsondhi does the throttle: { threshold: 1, period: 1.second } works for you? For me it's not, on ruby 1.9.3.

@rahilsondhi
Copy link

@dmitry that should work on its own, but this thread is about setting multiple thresholds.

I want max 1 per second and max 5000 per hour (two thresholds).

@dmitry
Copy link

dmitry commented Dec 17, 2014

Yes, I understand. But at least throttle: { threshold: 1, period: 1.second } doesn't work on my side, so it doesn't matter right now to work on this feature, before the issue with other one will not be fixed.

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

No branches or pull requests

3 participants