sidekiq-throttled 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/CHANGES.md +8 -0
- data/Gemfile +1 -0
- data/gemfiles/sidekiq_4.0.gemfile +2 -1
- data/gemfiles/sidekiq_4.1.gemfile +2 -1
- data/gemfiles/sidekiq_latest.gemfile +2 -1
- data/lib/sidekiq/throttled/strategy.rb +7 -7
- data/lib/sidekiq/throttled/strategy/concurrency.rb +8 -10
- data/lib/sidekiq/throttled/strategy/threshold.rb +8 -7
- data/lib/sidekiq/throttled/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 533d15834069284a6d4a781438724390ae8c185e
|
4
|
+
data.tar.gz: e7ef6171c7d1d50f4e73ca2d856ada94a861cd93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb0e8c60fa207fc0c79b051640ee6d0c4312e91f5b5fe327a48a383ff8c21cc706c57de346c71aa5c750e4b19339da3d700858c26574717a130393d20957ae69
|
7
|
+
data.tar.gz: 0d4c82ed8ff3e7af23e4adfeec283c40d4fe200de4342fad333b174e8b9f64ae6fb22641c916fea0aed9bc0a4dbe0611936a350ad691c2b360ded39a3769b6c7
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.6.6 (2016-10-16)
|
2
|
+
|
3
|
+
* [#24](https://github.com/sensortower/sidekiq-throttled/pull/24)
|
4
|
+
Fix dynamic `:key_suffix` issue.
|
5
|
+
([@iporsut])
|
6
|
+
|
7
|
+
|
1
8
|
## 0.6.5 (2016-09-04)
|
2
9
|
|
3
10
|
* Fix concurrency throttling when redis-namespace is used.
|
@@ -93,3 +100,4 @@
|
|
93
100
|
[@fhwang]: https://github.com/fhwang
|
94
101
|
[@palanglung]: https://github.com/palanglung
|
95
102
|
[@azach]: https://github.com/azach
|
103
|
+
[@iporsut]: https://github.com/iporsut
|
data/Gemfile
CHANGED
@@ -6,10 +6,11 @@ gem "appraisal"
|
|
6
6
|
gem "rake"
|
7
7
|
gem "rspec"
|
8
8
|
gem "rubocop", "~> 0.42.0", :require => false
|
9
|
+
gem "redis-namespace", :require => false
|
9
10
|
gem "sidekiq", "~> 4.0.0"
|
10
11
|
|
11
12
|
group :test do
|
12
|
-
gem "coveralls"
|
13
|
+
gem "coveralls", :require => false
|
13
14
|
gem "rack-test"
|
14
15
|
gem "simplecov", ">= 0.9"
|
15
16
|
gem "sinatra", "~> 1.4", ">= 1.4.6"
|
@@ -6,10 +6,11 @@ gem "appraisal"
|
|
6
6
|
gem "rake"
|
7
7
|
gem "rspec"
|
8
8
|
gem "rubocop", "~> 0.42.0", :require => false
|
9
|
+
gem "redis-namespace", :require => false
|
9
10
|
gem "sidekiq", "~> 4.1.0"
|
10
11
|
|
11
12
|
group :test do
|
12
|
-
gem "coveralls"
|
13
|
+
gem "coveralls", :require => false
|
13
14
|
gem "rack-test"
|
14
15
|
gem "simplecov", ">= 0.9"
|
15
16
|
gem "sinatra", "~> 1.4", ">= 1.4.6"
|
@@ -6,10 +6,11 @@ gem "appraisal"
|
|
6
6
|
gem "rake"
|
7
7
|
gem "rspec"
|
8
8
|
gem "rubocop", "~> 0.42.0", :require => false
|
9
|
+
gem "redis-namespace", :require => false
|
9
10
|
gem "sidekiq"
|
10
11
|
|
11
12
|
group :test do
|
12
|
-
gem "coveralls"
|
13
|
+
gem "coveralls", :require => false
|
13
14
|
gem "rack-test"
|
14
15
|
gem "simplecov", ">= 0.9"
|
15
16
|
gem "sinatra", "~> 1.4", ">= 1.4.6"
|
@@ -20,23 +20,23 @@ module Sidekiq
|
|
20
20
|
|
21
21
|
# @param [#to_s] name
|
22
22
|
# @param [Hash] concurrency Concurrency options.
|
23
|
-
# See {Strategy::Concurrency#initialize} for details.
|
23
|
+
# See keyword args of {Strategy::Concurrency#initialize} for details.
|
24
24
|
# @param [Hash] threshold Threshold options.
|
25
|
-
# See {Strategy::Threshold#initialize} for details.
|
26
|
-
# @param [
|
25
|
+
# See keyword args of {Strategy::Threshold#initialize} for details.
|
26
|
+
# @param [#call] key_suffix Dynamic key suffix generator.
|
27
27
|
def initialize(name, concurrency: nil, threshold: nil, key_suffix: nil)
|
28
28
|
key = "throttled:#{name}"
|
29
29
|
|
30
30
|
@concurrency =
|
31
31
|
if concurrency
|
32
|
-
concurrency[:key_suffix]
|
33
|
-
Concurrency.new(key, concurrency)
|
32
|
+
concurrency[:key_suffix] ||= key_suffix
|
33
|
+
Concurrency.new(key, **concurrency)
|
34
34
|
end
|
35
35
|
|
36
36
|
@threshold =
|
37
37
|
if threshold
|
38
|
-
threshold[:key_suffix]
|
39
|
-
Threshold.new(key, threshold)
|
38
|
+
threshold[:key_suffix] ||= key_suffix
|
39
|
+
Threshold.new(key, **threshold)
|
40
40
|
end
|
41
41
|
|
42
42
|
return if @concurrency || @threshold
|
@@ -18,17 +18,15 @@ module Sidekiq
|
|
18
18
|
private_constant :SCRIPT
|
19
19
|
|
20
20
|
# @param [#to_s] strategy_key
|
21
|
-
# @param [
|
22
|
-
#
|
23
|
-
#
|
24
|
-
# @
|
25
|
-
|
26
|
-
# @option opts :key_suffix Proc for dynamic key suffix.
|
27
|
-
def initialize(strategy_key, opts)
|
21
|
+
# @param [#to_i, #call] limit Amount of allowed concurrent jobs
|
22
|
+
# per processors running for given key.
|
23
|
+
# @param [#to_i] ttl Concurrency lock TTL in seconds.
|
24
|
+
# @param [Proc] key_suffix Dynamic key suffix generator.
|
25
|
+
def initialize(strategy_key, limit:, ttl: 900, key_suffix: nil)
|
28
26
|
@base_key = "#{strategy_key}:concurrency".freeze
|
29
|
-
@limit =
|
30
|
-
@ttl =
|
31
|
-
@key_suffix =
|
27
|
+
@limit = limit
|
28
|
+
@ttl = ttl.to_i
|
29
|
+
@key_suffix = key_suffix
|
32
30
|
end
|
33
31
|
|
34
32
|
# @return [Integer] Amount of allowed concurrent job processors
|
@@ -30,14 +30,15 @@ module Sidekiq
|
|
30
30
|
private_constant :SCRIPT
|
31
31
|
|
32
32
|
# @param [#to_s] strategy_key
|
33
|
-
# @param [
|
34
|
-
#
|
35
|
-
# @
|
36
|
-
|
33
|
+
# @param [#to_i, #call] limit Amount of allowed concurrent jobs
|
34
|
+
# per period running for given key.
|
35
|
+
# @param [#to_f, #call] :period Period in seconds.
|
36
|
+
# @param [Proc] key_suffix Dynamic key suffix generator.
|
37
|
+
def initialize(strategy_key, limit:, period:, key_suffix: nil)
|
37
38
|
@base_key = "#{strategy_key}:threshold".freeze
|
38
|
-
@limit =
|
39
|
-
@period =
|
40
|
-
@key_suffix =
|
39
|
+
@limit = limit
|
40
|
+
@period = period
|
41
|
+
@key_suffix = key_suffix
|
41
42
|
end
|
42
43
|
|
43
44
|
# @return [Integer] Amount of jobs allowed per period
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-throttled
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey V Zapparov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|