sidekiq-throttled 0.14.1 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +6 -9
- data/.rubocop.yml +1 -1
- data/Appraisals +8 -0
- data/CHANGES.md +37 -0
- data/LICENSE.md +1 -0
- data/README.md +4 -1
- data/gemfiles/sidekiq_5.0.gemfile +3 -3
- data/gemfiles/sidekiq_5.1.gemfile +3 -3
- data/gemfiles/sidekiq_5.2.gemfile +3 -3
- data/gemfiles/sidekiq_6.0.gemfile +3 -3
- data/gemfiles/sidekiq_6.1.gemfile +3 -3
- data/gemfiles/sidekiq_6.2.gemfile +31 -0
- data/gemfiles/sidekiq_6.3.gemfile +31 -0
- data/lib/sidekiq/throttled/communicator/callbacks.rb +4 -6
- data/lib/sidekiq/throttled/strategy/concurrency.rb +2 -2
- data/lib/sidekiq/throttled/strategy/threshold.rb +2 -2
- data/lib/sidekiq/throttled/strategy_collection.rb +2 -3
- data/lib/sidekiq/throttled/version.rb +1 -1
- data/sidekiq-throttled.gemspec +3 -3
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d5b08aaa416f7adec0d56410ddfef0fb59281bc27e18591d3c8544427b76013
|
4
|
+
data.tar.gz: fdad22d2e55acf1f0b3c7d70b415f809773282a506623adf19e35ce200d09cab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff4b9175c7efa4da06551237105de88c0a7a31d6f26fd7121d90c6e0da3b8e063ad8cb013ff62ff735ff8830350bf287362d2f1c3197b668b7abbe55be0c45ab
|
7
|
+
data.tar.gz: d4e6906ea2052f8543707f9ad9fcfeec275b5dae5f99082af9cdf5ba6d9a981c14dc62923913f64fe3c67171865b6289730061eead667aa820531ee0c92554cb
|
data/.github/workflows/ci.yml
CHANGED
@@ -11,9 +11,10 @@ jobs:
|
|
11
11
|
name: "rspec (ruby:${{ matrix.ruby }} sidekiq:${{ matrix.sidekiq }})"
|
12
12
|
|
13
13
|
strategy:
|
14
|
+
fail-fast: false
|
14
15
|
matrix:
|
15
|
-
ruby: [ "2.6", "2.7" ]
|
16
|
-
sidekiq: [ "5.0", "5.1", "5.2", "6.0", "6.1" ]
|
16
|
+
ruby: [ "2.6", "2.7", "3.0" ]
|
17
|
+
sidekiq: [ "5.0", "5.1", "5.2", "6.0", "6.1", "6.2", "6.3" ]
|
17
18
|
|
18
19
|
runs-on: ubuntu-latest
|
19
20
|
|
@@ -32,9 +33,7 @@ jobs:
|
|
32
33
|
- uses: ruby/setup-ruby@v1
|
33
34
|
with:
|
34
35
|
ruby-version: ${{ matrix.ruby }}
|
35
|
-
|
36
|
-
- name: bundle install
|
37
|
-
run: bundle install --without development --jobs 4 --retry 3
|
36
|
+
bundler-cache: true
|
38
37
|
|
39
38
|
- run: bundle exec rspec
|
40
39
|
|
@@ -46,9 +45,7 @@ jobs:
|
|
46
45
|
|
47
46
|
- uses: ruby/setup-ruby@v1
|
48
47
|
with:
|
49
|
-
ruby-version: "2.
|
50
|
-
|
51
|
-
- name: bundle install
|
52
|
-
run: bundle install --without development --jobs 4 --retry 3
|
48
|
+
ruby-version: "2.6"
|
49
|
+
bundler-cache: true
|
53
50
|
|
54
51
|
- run: bundle exec rubocop
|
data/.rubocop.yml
CHANGED
data/Appraisals
CHANGED
data/CHANGES.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
## 0.15.1 (2023-04-10)
|
2
|
+
|
3
|
+
* Lock `redis-prescription` to `~> 2.5` and update the code
|
4
|
+
|
5
|
+
## 0.15.0 (2021-12-16)
|
6
|
+
|
7
|
+
* [#102](https://github.com/sensortower/sidekiq-throttled/pull/102)
|
8
|
+
Support Ruby 3.0 and Sidekiq 6.2+.
|
9
|
+
([@ybiquitous])
|
10
|
+
|
11
|
+
* [#97](https://github.com/sensortower/sidekiq-throttled/pull/97)
|
12
|
+
Fix kwargs usage in strategy collection.
|
13
|
+
([@baptistejub])
|
14
|
+
|
15
|
+
## 0.14.0 (2021-09-21)
|
16
|
+
|
17
|
+
* [#98](https://github.com/sensortower/sidekiq-throttled/pull/98)
|
18
|
+
Remove warning for strategy override.
|
19
|
+
([@mattiagiuffrida-st])
|
20
|
+
|
21
|
+
* [#65](https://github.com/sensortower/sidekiq-throttled/pull/65)
|
22
|
+
Support composite (multi-key) strategies.
|
23
|
+
([@holyketzer])
|
24
|
+
|
25
|
+
* [#89](https://github.com/sensortower/sidekiq-throttled/pull/89),
|
26
|
+
[#96](https://github.com/sensortower/sidekiq-throttled/pull/96), and
|
27
|
+
[#93](https://github.com/sensortower/sidekiq-throttled/pull/93)
|
28
|
+
Improve documentation.
|
29
|
+
([@hubertjakubiak], [@khaile], and [@kylerippey])
|
30
|
+
|
1
31
|
## 0.13.0 (2020-07-28)
|
2
32
|
|
3
33
|
* [#85](https://github.com/sensortower/sidekiq-throttled/pull/85)
|
@@ -221,3 +251,10 @@
|
|
221
251
|
[@lenon]: https://github.com/lenon
|
222
252
|
[@vaot]: https://github.com/vaot
|
223
253
|
[@hmaack]: https://github.com/hmaack
|
254
|
+
[@holyketzer]: https://github.com/holyketzer
|
255
|
+
[@hubertjakubiak]: https://github.com/hubertjakubiak
|
256
|
+
[@kylerippey]: https://github.com/kylerippey
|
257
|
+
[@khaile]: https://github.com/khaile
|
258
|
+
[@mattiagiuffrida-st]: https://github.com/mattiagiuffrida-st
|
259
|
+
[@baptistejub]: https://github.com/baptistejub
|
260
|
+
[@ybiquitous]: https://github.com/ybiquitous
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -235,6 +235,7 @@ versions:
|
|
235
235
|
|
236
236
|
* Ruby 2.6.x
|
237
237
|
* Ruby 2.7.x
|
238
|
+
* Ruby 3.0.x
|
238
239
|
|
239
240
|
If something doesn't work on one of these versions, it's a bug.
|
240
241
|
|
@@ -259,6 +260,8 @@ This library aims to support work with following [Sidekiq][sidekiq] versions:
|
|
259
260
|
* Sidekiq 5.2.x
|
260
261
|
* Sidekiq 6.0.x
|
261
262
|
* Sidekiq 6.1.x
|
263
|
+
* Sidekiq 6.2.x
|
264
|
+
* Sidekiq 6.3.x
|
262
265
|
|
263
266
|
|
264
267
|
## Contributing
|
@@ -286,7 +289,7 @@ Don't forget to run `appraisal update` after any changes to `Gemfile`.
|
|
286
289
|
|
287
290
|
## Copyright
|
288
291
|
|
289
|
-
Copyright (c)
|
292
|
+
Copyright (c) 2020-2021 Alexey Zapparov, SensorTower Inc.
|
290
293
|
See LICENSE.md for further details.
|
291
294
|
|
292
295
|
|
@@ -5,9 +5,9 @@ source "https://rubygems.org"
|
|
5
5
|
gem "appraisal"
|
6
6
|
gem "rake"
|
7
7
|
gem "rspec"
|
8
|
-
gem "rubocop", "~> 0.
|
9
|
-
gem "rubocop-performance", "~>1.
|
10
|
-
gem "rubocop-rspec", "~> 1.
|
8
|
+
gem "rubocop", "~> 0.90.0", require: false
|
9
|
+
gem "rubocop-performance", "~> 1.8.0", require: false
|
10
|
+
gem "rubocop-rspec", "~> 1.43.2", require: false
|
11
11
|
gem "sidekiq", "~> 5.0.0"
|
12
12
|
|
13
13
|
group :development do
|
@@ -5,9 +5,9 @@ source "https://rubygems.org"
|
|
5
5
|
gem "appraisal"
|
6
6
|
gem "rake"
|
7
7
|
gem "rspec"
|
8
|
-
gem "rubocop", "~> 0.
|
9
|
-
gem "rubocop-performance", "~>1.
|
10
|
-
gem "rubocop-rspec", "~> 1.
|
8
|
+
gem "rubocop", "~> 0.90.0", require: false
|
9
|
+
gem "rubocop-performance", "~> 1.8.0", require: false
|
10
|
+
gem "rubocop-rspec", "~> 1.43.2", require: false
|
11
11
|
gem "sidekiq", "~> 5.1.0"
|
12
12
|
|
13
13
|
group :development do
|
@@ -5,9 +5,9 @@ source "https://rubygems.org"
|
|
5
5
|
gem "appraisal"
|
6
6
|
gem "rake"
|
7
7
|
gem "rspec"
|
8
|
-
gem "rubocop", "~> 0.
|
9
|
-
gem "rubocop-performance", "~>1.
|
10
|
-
gem "rubocop-rspec", "~> 1.
|
8
|
+
gem "rubocop", "~> 0.90.0", require: false
|
9
|
+
gem "rubocop-performance", "~> 1.8.0", require: false
|
10
|
+
gem "rubocop-rspec", "~> 1.43.2", require: false
|
11
11
|
gem "sidekiq", "~> 5.2.0"
|
12
12
|
|
13
13
|
group :development do
|
@@ -5,9 +5,9 @@ source "https://rubygems.org"
|
|
5
5
|
gem "appraisal"
|
6
6
|
gem "rake"
|
7
7
|
gem "rspec"
|
8
|
-
gem "rubocop", "~> 0.
|
9
|
-
gem "rubocop-performance", "~>1.
|
10
|
-
gem "rubocop-rspec", "~> 1.
|
8
|
+
gem "rubocop", "~> 0.90.0", require: false
|
9
|
+
gem "rubocop-performance", "~> 1.8.0", require: false
|
10
|
+
gem "rubocop-rspec", "~> 1.43.2", require: false
|
11
11
|
gem "sidekiq", "~> 6.0.0"
|
12
12
|
|
13
13
|
group :development do
|
@@ -5,9 +5,9 @@ source "https://rubygems.org"
|
|
5
5
|
gem "appraisal"
|
6
6
|
gem "rake"
|
7
7
|
gem "rspec"
|
8
|
-
gem "rubocop", "~> 0.
|
9
|
-
gem "rubocop-performance", "~>1.
|
10
|
-
gem "rubocop-rspec", "~> 1.
|
8
|
+
gem "rubocop", "~> 0.90.0", require: false
|
9
|
+
gem "rubocop-performance", "~> 1.8.0", require: false
|
10
|
+
gem "rubocop-rspec", "~> 1.43.2", require: false
|
11
11
|
gem "sidekiq", "~> 6.1.0"
|
12
12
|
|
13
13
|
group :development do
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "rake"
|
7
|
+
gem "rspec"
|
8
|
+
gem "rubocop", "~> 0.90.0", require: false
|
9
|
+
gem "rubocop-performance", "~> 1.8.0", require: false
|
10
|
+
gem "rubocop-rspec", "~> 1.43.2", require: false
|
11
|
+
gem "sidekiq", "~> 6.2.0"
|
12
|
+
|
13
|
+
group :development do
|
14
|
+
gem "byebug"
|
15
|
+
gem "guard", require: false
|
16
|
+
gem "guard-rspec", require: false
|
17
|
+
gem "guard-rubocop", require: false
|
18
|
+
end
|
19
|
+
|
20
|
+
group :test do
|
21
|
+
gem "apparition"
|
22
|
+
gem "capybara"
|
23
|
+
gem "coveralls", require: false
|
24
|
+
gem "puma"
|
25
|
+
gem "rack-test"
|
26
|
+
gem "simplecov"
|
27
|
+
gem "sinatra"
|
28
|
+
gem "timecop"
|
29
|
+
end
|
30
|
+
|
31
|
+
gemspec path: "../"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "rake"
|
7
|
+
gem "rspec"
|
8
|
+
gem "rubocop", "~> 0.90.0", require: false
|
9
|
+
gem "rubocop-performance", "~> 1.8.0", require: false
|
10
|
+
gem "rubocop-rspec", "~> 1.43.2", require: false
|
11
|
+
gem "sidekiq", "~> 6.3.0"
|
12
|
+
|
13
|
+
group :development do
|
14
|
+
gem "byebug"
|
15
|
+
gem "guard", require: false
|
16
|
+
gem "guard-rspec", require: false
|
17
|
+
gem "guard-rubocop", require: false
|
18
|
+
end
|
19
|
+
|
20
|
+
group :test do
|
21
|
+
gem "apparition"
|
22
|
+
gem "capybara"
|
23
|
+
gem "coveralls", require: false
|
24
|
+
gem "puma"
|
25
|
+
gem "rack-test"
|
26
|
+
gem "simplecov"
|
27
|
+
gem "sinatra"
|
28
|
+
gem "timecop"
|
29
|
+
end
|
30
|
+
|
31
|
+
gemspec path: "../"
|
@@ -53,15 +53,13 @@ module Sidekiq
|
|
53
53
|
# @param [#to_s] event
|
54
54
|
# @param [Object] payload
|
55
55
|
# @return [void]
|
56
|
-
def run(event, payload = nil)
|
56
|
+
def run(event, payload = nil)
|
57
57
|
@mutex.synchronize do
|
58
58
|
fiber = Fiber.new do
|
59
59
|
@handlers[event.to_s].each do |callback|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
handle_exception(e, :context => "sidekiq:throttled")
|
64
|
-
end
|
60
|
+
callback.call(payload)
|
61
|
+
rescue => e
|
62
|
+
handle_exception(e, :context => "sidekiq:throttled")
|
65
63
|
end
|
66
64
|
end
|
67
65
|
|
@@ -20,7 +20,7 @@ module Sidekiq
|
|
20
20
|
# PUSH(@key, @jid)
|
21
21
|
# return 0
|
22
22
|
# end
|
23
|
-
SCRIPT =
|
23
|
+
SCRIPT = RedisPrescription.new(File.read("#{__dir__}/concurrency.lua"))
|
24
24
|
private_constant :SCRIPT
|
25
25
|
|
26
26
|
# @param [#to_s] strategy_key
|
@@ -50,7 +50,7 @@ module Sidekiq
|
|
50
50
|
argv = [jid.to_s, job_limit, @ttl, Time.now.to_f]
|
51
51
|
|
52
52
|
Sidekiq.redis do |redis|
|
53
|
-
1 == SCRIPT.
|
53
|
+
1 == SCRIPT.call(redis, :keys => keys, :argv => argv)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -30,7 +30,7 @@ module Sidekiq
|
|
30
30
|
#
|
31
31
|
# increase!
|
32
32
|
# return 0
|
33
|
-
SCRIPT =
|
33
|
+
SCRIPT = RedisPrescription.new(File.read("#{__dir__}/threshold.lua"))
|
34
34
|
private_constant :SCRIPT
|
35
35
|
|
36
36
|
# @param [#to_s] strategy_key
|
@@ -67,7 +67,7 @@ module Sidekiq
|
|
67
67
|
argv = [job_limit, period(job_args), Time.now.to_f]
|
68
68
|
|
69
69
|
Sidekiq.redis do |redis|
|
70
|
-
1 == SCRIPT.
|
70
|
+
1 == SCRIPT.call(redis, :keys => keys, :argv => argv)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -60,10 +60,9 @@ module Sidekiq
|
|
60
60
|
def make_strategy(strategy, name, key_suffix, options)
|
61
61
|
return unless options
|
62
62
|
|
63
|
-
strategy.new("throttled:#{name}",
|
63
|
+
strategy.new("throttled:#{name}",
|
64
64
|
:key_suffix => key_suffix,
|
65
|
-
**options
|
66
|
-
})
|
65
|
+
**options)
|
67
66
|
end
|
68
67
|
end
|
69
68
|
end
|
data/sidekiq-throttled.gemspec
CHANGED
@@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
|
-
spec.required_ruby_version = "
|
27
|
+
spec.required_ruby_version = ">= 2.6"
|
28
28
|
|
29
29
|
spec.add_runtime_dependency "concurrent-ruby"
|
30
|
-
spec.add_runtime_dependency "redis-prescription"
|
30
|
+
spec.add_runtime_dependency "redis-prescription", "~> 2.5"
|
31
31
|
spec.add_runtime_dependency "sidekiq"
|
32
32
|
|
33
|
-
spec.add_development_dependency "bundler", "
|
33
|
+
spec.add_development_dependency "bundler", ">= 2.0"
|
34
34
|
end
|
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.
|
4
|
+
version: 0.15.1
|
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:
|
11
|
+
date: 2023-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: redis-prescription
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sidekiq
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.0'
|
69
69
|
description: Concurrency and threshold throttling for Sidekiq.
|
@@ -99,6 +99,8 @@ files:
|
|
99
99
|
- gemfiles/sidekiq_5.2.gemfile
|
100
100
|
- gemfiles/sidekiq_6.0.gemfile
|
101
101
|
- gemfiles/sidekiq_6.1.gemfile
|
102
|
+
- gemfiles/sidekiq_6.2.gemfile
|
103
|
+
- gemfiles/sidekiq_6.3.gemfile
|
102
104
|
- lib/sidekiq/throttled.rb
|
103
105
|
- lib/sidekiq/throttled/communicator.rb
|
104
106
|
- lib/sidekiq/throttled/communicator/callbacks.rb
|
@@ -141,7 +143,7 @@ require_paths:
|
|
141
143
|
- lib
|
142
144
|
required_ruby_version: !ruby/object:Gem::Requirement
|
143
145
|
requirements:
|
144
|
-
- - "
|
146
|
+
- - ">="
|
145
147
|
- !ruby/object:Gem::Version
|
146
148
|
version: '2.6'
|
147
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -150,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
152
|
- !ruby/object:Gem::Version
|
151
153
|
version: '0'
|
152
154
|
requirements: []
|
153
|
-
rubygems_version: 3.1.
|
155
|
+
rubygems_version: 3.1.6
|
154
156
|
signing_key:
|
155
157
|
specification_version: 4
|
156
158
|
summary: Concurrency and threshold throttling for Sidekiq.
|