sidekiq-throttler 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/lib/sidekiq/throttler.rb +1 -0
- data/lib/sidekiq/throttler/version.rb +1 -1
- data/sidekiq-throttler.gemspec +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a48a69a956224bcd3ea8fae08c21210e44f9aee
|
4
|
+
data.tar.gz: 0f9146f8756e701ae3d1eb0beef9654dd0074c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4608ce6e67d51e53626a8d63fbf9d06e462fc502d01cce70eb1997d726a285ec65406cc0d8aa5a59abf375ec153d76d983d4af03a6b4e138959305f66ea61bdb
|
7
|
+
data.tar.gz: bb21a8d354dc7f609beb4e65886479d0688101407087b2b8b45038257f59c178719e91255f8999eff1eeee11b0a08c8bf4875f79e7382bdf0f108622e251f230
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -72,7 +72,7 @@ If throttling is per-user, for example, you can specify a `Proc` for `key` which
|
|
72
72
|
accepts the arguments passed to your worker's `perform` method:
|
73
73
|
|
74
74
|
```ruby
|
75
|
-
sidekiq_options throttle: { threshold: 20, period: 1.day, key: ->{
|
75
|
+
sidekiq_options throttle: { threshold: 20, period: 1.day, key: ->(user_id){ user_id } }
|
76
76
|
```
|
77
77
|
|
78
78
|
In the above example, jobs are throttled for each user when they exceed 20 in a
|
@@ -82,7 +82,7 @@ Thresholds can be configured based on the arguments passed to your worker's `per
|
|
82
82
|
similar to how the `key` option works:
|
83
83
|
|
84
84
|
```ruby
|
85
|
-
sidekiq_options throttle: { threshold: ->
|
85
|
+
sidekiq_options throttle: { threshold: ->(user_id, rate_limit) { rate_limit }, period: 1.hour, key: ->(user_id, rate_limit){ user_id } }
|
86
86
|
```
|
87
87
|
|
88
88
|
In the above example, jobs are throttled for each user when they exceed the rate limit provided in the message. This is useful in cases where each user may have a different rate limit (ex: interacting with external APIs)
|
data/lib/sidekiq/throttler.rb
CHANGED
data/sidekiq-throttler.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.description = %q{Sidekiq middleware that adds the ability to rate limit job execution.}
|
12
12
|
gem.summary = %q{Sidekiq::Throttler is a middleware for Sidekiq that adds the ability to rate limit job execution on a per-worker basis.}
|
13
13
|
gem.homepage = 'https://github.com/gevans/sidekiq-throttler'
|
14
|
+
gem.license = 'MIT'
|
14
15
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-throttler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabe Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -290,7 +290,8 @@ files:
|
|
290
290
|
- spec/spec_helper.rb
|
291
291
|
- spec/support/sidekiq.rb
|
292
292
|
homepage: https://github.com/gevans/sidekiq-throttler
|
293
|
-
licenses:
|
293
|
+
licenses:
|
294
|
+
- MIT
|
294
295
|
metadata: {}
|
295
296
|
post_install_message:
|
296
297
|
rdoc_options: []
|