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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe88fba2840a8a649b6a02951a246176e8b548257997aeaf922c7582e8c27e17
4
- data.tar.gz: 76ba37d70509e33a266e7ad1e9e51babd4afd874788a1548b1aabc3a1c1cad87
3
+ metadata.gz: 0d5b08aaa416f7adec0d56410ddfef0fb59281bc27e18591d3c8544427b76013
4
+ data.tar.gz: fdad22d2e55acf1f0b3c7d70b415f809773282a506623adf19e35ce200d09cab
5
5
  SHA512:
6
- metadata.gz: 14979e92d96a56096f19e61a40f8343025de2ccb4a57ede6f311be83acd80cca44d9bae7448ad2453e9539aa599c6154d2eec9f2a285148f14d2ad70fa9d86c4
7
- data.tar.gz: 8ad7ee2999f8ab2645bdff54efc2b2592b5d416807795f58454af1a5f03ae3099975db492bbab4658cd2b9d5160af705c5509536c9dd7dddaa1db35c5ebe4448
6
+ metadata.gz: ff4b9175c7efa4da06551237105de88c0a7a31d6f26fd7121d90c6e0da3b8e063ad8cb013ff62ff735ff8830350bf287362d2f1c3197b668b7abbe55be0c45ab
7
+ data.tar.gz: d4e6906ea2052f8543707f9ad9fcfeec275b5dae5f99082af9cdf5ba6d9a981c14dc62923913f64fe3c67171865b6289730061eead667aa820531ee0c92554cb
@@ -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.4"
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
@@ -16,4 +16,4 @@ AllCops:
16
16
  - gemfiles/**/*
17
17
  - vendor/**/*
18
18
  NewCops: enable
19
- TargetRubyVersion: 2.4
19
+ TargetRubyVersion: 2.6
data/Appraisals CHANGED
@@ -19,3 +19,11 @@ end
19
19
  appraise "sidekiq-6.1" do
20
20
  gem "sidekiq", "~> 6.1.0"
21
21
  end
22
+
23
+ appraise "sidekiq-6.2" do
24
+ gem "sidekiq", "~> 6.2.0"
25
+ end
26
+
27
+ appraise "sidekiq-6.3" do
28
+ gem "sidekiq", "~> 6.3.0"
29
+ end
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
@@ -1,5 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
+ Copyright (c) 2020-2021 Alexey Zapparov, SensorTower Inc.
3
4
  Copyright (c) 2015-2020 SensorTower Inc.
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
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) 2015-2020 SensorTower Inc.
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.82.0", require: false
9
- gem "rubocop-performance", "~>1.5.2", require: false
10
- gem "rubocop-rspec", "~> 1.39.0", require: false
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.82.0", require: false
9
- gem "rubocop-performance", "~>1.5.2", require: false
10
- gem "rubocop-rspec", "~> 1.39.0", require: false
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.82.0", require: false
9
- gem "rubocop-performance", "~>1.5.2", require: false
10
- gem "rubocop-rspec", "~> 1.39.0", require: false
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.82.0", require: false
9
- gem "rubocop-performance", "~>1.5.2", require: false
10
- gem "rubocop-rspec", "~> 1.39.0", require: false
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.82.0", require: false
9
- gem "rubocop-performance", "~>1.5.2", require: false
10
- gem "rubocop-rspec", "~> 1.39.0", require: false
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) # rubocop:disable Metrics/MethodLength
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
- begin
61
- callback.call(payload)
62
- rescue => e
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 = Redis::Prescription.read "#{__dir__}/concurrency.lua"
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.eval(redis, :keys => keys, :argv => argv)
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 = Redis::Prescription.read "#{__dir__}/threshold.lua"
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.eval(redis, :keys => keys, :argv => argv)
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
@@ -3,6 +3,6 @@
3
3
  module Sidekiq
4
4
  module Throttled
5
5
  # Gem version
6
- VERSION = "0.14.1"
6
+ VERSION = "0.15.1"
7
7
  end
8
8
  end
@@ -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 = "~> 2.6"
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", "~> 2.0"
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.14.1
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: 2021-09-21 00:00:00.000000000 Z
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: '0'
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: '0'
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.4
155
+ rubygems_version: 3.1.6
154
156
  signing_key:
155
157
  specification_version: 4
156
158
  summary: Concurrency and threshold throttling for Sidekiq.