sidekiq-throttled 0.11.0 → 0.15.0

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +51 -0
  3. data/.rubocop/layout.yml +24 -0
  4. data/.rubocop/lint.yml +41 -0
  5. data/.rubocop/metrics.yml +4 -0
  6. data/.rubocop/performance.yml +25 -0
  7. data/.rubocop/rspec.yml +3 -0
  8. data/.rubocop/style.yml +84 -0
  9. data/.rubocop.yml +13 -68
  10. data/.rubocop_todo.yml +10 -35
  11. data/.travis.yml +2 -1
  12. data/Appraisals +16 -0
  13. data/CHANGES.md +53 -0
  14. data/Gemfile +6 -5
  15. data/LICENSE.md +2 -1
  16. data/README.md +49 -18
  17. data/gemfiles/sidekiq_5.0.gemfile +6 -5
  18. data/gemfiles/sidekiq_5.1.gemfile +6 -5
  19. data/gemfiles/sidekiq_5.2.gemfile +6 -5
  20. data/gemfiles/sidekiq_6.0.gemfile +31 -0
  21. data/gemfiles/sidekiq_6.1.gemfile +31 -0
  22. data/gemfiles/sidekiq_6.2.gemfile +31 -0
  23. data/gemfiles/sidekiq_6.3.gemfile +31 -0
  24. data/lib/sidekiq/throttled/communicator/callbacks.rb +8 -9
  25. data/lib/sidekiq/throttled/communicator/listener.rb +3 -3
  26. data/lib/sidekiq/throttled/expirable_list.rb +1 -1
  27. data/lib/sidekiq/throttled/fetch.rb +34 -20
  28. data/lib/sidekiq/throttled/queue_name.rb +1 -1
  29. data/lib/sidekiq/throttled/registry.rb +2 -5
  30. data/lib/sidekiq/throttled/strategy/concurrency.rb +5 -5
  31. data/lib/sidekiq/throttled/strategy/threshold.rb +6 -5
  32. data/lib/sidekiq/throttled/strategy.rb +15 -20
  33. data/lib/sidekiq/throttled/strategy_collection.rb +69 -0
  34. data/lib/sidekiq/throttled/utils.rb +1 -1
  35. data/lib/sidekiq/throttled/version.rb +1 -1
  36. data/lib/sidekiq/throttled/web/stats.rb +2 -6
  37. data/lib/sidekiq/throttled/web/summary_fix.rb +3 -2
  38. data/lib/sidekiq/throttled/web/throttled.html.erb +6 -2
  39. data/lib/sidekiq/throttled/web.rb +1 -1
  40. data/lib/sidekiq/throttled/worker.rb +2 -2
  41. data/lib/sidekiq/throttled.rb +14 -2
  42. data/sidekiq-throttled.gemspec +3 -1
  43. metadata +21 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '05945dcd1de433dd74010e8fa402c6fb2e6100fb6306aef386536da24cd2e08b'
4
- data.tar.gz: fe07b3c6409e7749f2af3b85d36e27dcda5d53b92c771e050a951f6175cec407
3
+ metadata.gz: f6dcc92c4940527e645d6a211b068094aef5c1f1cb103ad07d74b9b42132eb80
4
+ data.tar.gz: c2a8b341bfc9586a97f5f918b19bcf0e35ec4c93b5e2955802d26e5846cb7351
5
5
  SHA512:
6
- metadata.gz: 2965642d0564eaf45c033b6c6d6ddfe5b80804eebfbfef7908c4f81bbc450baec4e71d1b70fe21bf6515336d173b3a95e74c4b97aa26d35a3947b7b24ba02c1e
7
- data.tar.gz: 149ba3f6d29c9963c52f96d7ea1b6be23424726a7791afe7c3fad4ab95bf82b2db0df274ee3a26842e7726e1f403afff2d99c997f1033f2ddb63a95f9790d698
6
+ metadata.gz: d587a45dcf488a6ff722082c3ddf27c52bf19f4575fab922789580f36bae4031fe8f20d6825e0490d253f6f36f52a5c026b78bcd8b72de919fe094130c48c609
7
+ data.tar.gz: cdf97140a7cc3bc78720f59acd629d54ea4fbca2d5a3b8696cb92695b1b73d7b070dc7074a4278af6562a01987eeee3e7ce57c5405b5d23b0fb54afdd04458d3
@@ -0,0 +1,51 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ rspec:
11
+ name: "rspec (ruby:${{ matrix.ruby }} sidekiq:${{ matrix.sidekiq }})"
12
+
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ ruby: [ "2.6", "2.7", "3.0" ]
17
+ sidekiq: [ "5.0", "5.1", "5.2", "6.0", "6.1", "6.2", "6.3" ]
18
+
19
+ runs-on: ubuntu-latest
20
+
21
+ services:
22
+ redis:
23
+ image: redis
24
+ ports: ["6379:6379"]
25
+ options: "--entrypoint redis-server"
26
+
27
+ env:
28
+ GEMFILE: gemfiles/sidekiq_${{ matrix.sidekiq }}.gemfile
29
+
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+
33
+ - uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: ${{ matrix.ruby }}
36
+ bundler-cache: true
37
+
38
+ - run: bundle exec rspec
39
+
40
+ rubocop:
41
+ runs-on: ubuntu-latest
42
+
43
+ steps:
44
+ - uses: actions/checkout@v2
45
+
46
+ - uses: ruby/setup-ruby@v1
47
+ with:
48
+ ruby-version: "2.6"
49
+ bundler-cache: true
50
+
51
+ - run: bundle exec rubocop
@@ -0,0 +1,24 @@
1
+ Layout/ArgumentAlignment:
2
+ EnforcedStyle: with_fixed_indentation
3
+
4
+ Layout/EmptyLinesAroundAttributeAccessor:
5
+ Enabled: true
6
+
7
+ Layout/FirstArrayElementIndentation:
8
+ EnforcedStyle: consistent
9
+
10
+ Layout/FirstHashElementIndentation:
11
+ Enabled: true
12
+ EnforcedStyle: consistent
13
+
14
+ Layout/HashAlignment:
15
+ Enabled: true
16
+ EnforcedHashRocketStyle: table
17
+ EnforcedColonStyle: table
18
+
19
+ Layout/SpaceAroundMethodCallOperator:
20
+ Enabled: true
21
+
22
+ Layout/MultilineMethodCallIndentation:
23
+ Enabled: true
24
+ EnforcedStyle: indented
data/.rubocop/lint.yml ADDED
@@ -0,0 +1,41 @@
1
+ Lint/BinaryOperatorWithIdenticalOperands:
2
+ Enabled: true
3
+
4
+ Lint/DeprecatedOpenSSLConstant:
5
+ Enabled: true
6
+
7
+ Lint/DuplicateElsifCondition:
8
+ Enabled: true
9
+
10
+ Lint/DuplicateRescueException:
11
+ Enabled: true
12
+
13
+ Lint/EmptyConditionalBody:
14
+ Enabled: true
15
+
16
+ Lint/FloatComparison:
17
+ Enabled: true
18
+
19
+ Lint/MissingSuper:
20
+ Enabled: true
21
+
22
+ Lint/MixedRegexpCaptureTypes:
23
+ Enabled: true
24
+
25
+ Lint/OutOfRangeRegexpRef:
26
+ Enabled: true
27
+
28
+ Lint/RaiseException:
29
+ Enabled: true
30
+
31
+ Lint/SelfAssignment:
32
+ Enabled: true
33
+
34
+ Lint/StructNewOverride:
35
+ Enabled: true
36
+
37
+ Lint/TopLevelReturnWithArgument:
38
+ Enabled: true
39
+
40
+ Lint/UnreachableLoop:
41
+ Enabled: true
@@ -0,0 +1,4 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - "spec/**/*_spec.rb"
4
+ - "**/*.gemspec"
@@ -0,0 +1,25 @@
1
+ Performance/AncestorsInclude:
2
+ Enabled: true
3
+
4
+ Performance/BigDecimalWithNumericArgument:
5
+ Enabled: true
6
+
7
+ Performance/RedundantSortBlock:
8
+ Enabled: true
9
+
10
+ Performance/RedundantStringChars:
11
+ Enabled: true
12
+
13
+ Performance/ReverseFirst:
14
+ Enabled: true
15
+
16
+ Performance/SortReverse:
17
+ Enabled: true
18
+
19
+ Performance/Squeeze:
20
+ Enabled: true
21
+
22
+ Performance/StringInclude:
23
+ Enabled: true
24
+
25
+
@@ -0,0 +1,3 @@
1
+ RSpec/ExampleLength:
2
+ Enabled: true
3
+ Max: 10
@@ -0,0 +1,84 @@
1
+ Style/AccessorGrouping:
2
+ Enabled: true
3
+
4
+ Style/ArrayCoercion:
5
+ Enabled: true
6
+
7
+ Style/BisectedAttrAccessor:
8
+ Enabled: true
9
+
10
+ Style/CaseLikeIf:
11
+ Enabled: true
12
+
13
+ Style/Documentation:
14
+ Enabled: false
15
+
16
+ Style/ExplicitBlockArgument:
17
+ Enabled: true
18
+
19
+ Style/ExponentialNotation:
20
+ Enabled: true
21
+
22
+ Style/GlobalStdStream:
23
+ Enabled: true
24
+
25
+ Style/HashAsLastArrayItem:
26
+ Enabled: true
27
+
28
+ Style/HashEachMethods:
29
+ Enabled: true
30
+
31
+ Style/HashLikeCase:
32
+ Enabled: true
33
+
34
+ Style/HashSyntax:
35
+ Enabled: true
36
+ EnforcedStyle: hash_rockets
37
+
38
+ Style/HashTransformKeys:
39
+ Enabled: true
40
+
41
+ Style/HashTransformValues:
42
+ Enabled: true
43
+
44
+ Style/OptionalBooleanParameter:
45
+ Enabled: true
46
+
47
+ Style/RedundantAssignment:
48
+ Enabled: true
49
+
50
+ Style/RedundantFetchBlock:
51
+ Enabled: true
52
+
53
+ Style/RedundantFileExtensionInRequire:
54
+ Enabled: true
55
+
56
+ Style/RedundantRegexpCharacterClass:
57
+ Enabled: true
58
+
59
+ Style/RedundantRegexpEscape:
60
+ Enabled: true
61
+
62
+ Style/RegexpLiteral:
63
+ Enabled: true
64
+ EnforcedStyle: percent_r
65
+
66
+ Style/RescueStandardError:
67
+ Enabled: true
68
+ EnforcedStyle: implicit
69
+
70
+ Style/SingleArgumentDig:
71
+ Enabled: true
72
+
73
+ Style/SlicingWithRange:
74
+ Enabled: true
75
+
76
+ Style/StringConcatenation:
77
+ Enabled: true
78
+
79
+ Style/StringLiterals:
80
+ Enabled: true
81
+ EnforcedStyle: double_quotes
82
+
83
+ Style/YodaCondition:
84
+ Enabled: false
data/.rubocop.yml CHANGED
@@ -1,74 +1,19 @@
1
- inherit_from:
2
- - .rubocop_todo.yml
3
-
4
1
  require:
2
+ - rubocop-performance
5
3
  - rubocop-rspec
6
4
 
7
- ################################################################################
5
+ inherit_from:
6
+ - .rubocop_todo.yml
7
+ - .rubocop/layout.yml
8
+ - .rubocop/lint.yml
9
+ - .rubocop/metrics.yml
10
+ - .rubocop/performance.yml
11
+ - .rubocop/rspec.yml
12
+ - .rubocop/style.yml
8
13
 
9
14
  AllCops:
10
- DisplayCopNames: true
11
- TargetRubyVersion: 2.4
12
- Exclude:
13
- - "gemfiles/*"
14
-
15
- ## Layout ######################################################################
16
-
17
- Layout/AlignHash:
18
- EnforcedHashRocketStyle: table
19
-
20
- Layout/AlignParameters:
21
- EnforcedStyle: with_fixed_indentation
22
-
23
- Layout/IndentArray:
24
- EnforcedStyle: consistent
25
-
26
- Layout/IndentHash:
27
- EnforcedStyle: consistent
28
-
29
- Layout/MultilineMethodCallIndentation:
30
- EnforcedStyle: indented
31
-
32
- Layout/SpaceInLambdaLiteral:
33
- EnforcedStyle: require_space
34
-
35
- ## Metrics #####################################################################
36
-
37
- Metrics/BlockLength:
38
15
  Exclude:
39
- - "Guardfile"
40
- - "spec/**/*"
41
-
42
- ## Styles ######################################################################
43
-
44
- Style/BracesAroundHashParameters:
45
- Enabled: false
46
-
47
- Style/Documentation:
48
- Enabled: false
49
-
50
- Style/HashSyntax:
51
- EnforcedStyle: hash_rockets
52
-
53
- # Follow your heart where it makes sense to use lambda or lambda literal.
54
- # Enforcing it makes some pieces of code look REALLY terrible, e.g. in
55
- # case of empty (noop) lambdas: `lambda { |_| }`.
56
- Style/Lambda:
57
- Enabled: false
58
-
59
- # Enabling this cop makes Guardfile (which is full of pathname regexps)
60
- # look absolutley style-inconsistent and terrible. In any case, this should
61
- # be on developer's choice whenever to use `%r` or not. Just like we don't
62
- # enforce to use `["foo"]` over `%w(foo)` and so on.
63
- Style/RegexpLiteral:
64
- Enabled: false
65
-
66
- Style/RescueStandardError:
67
- EnforcedStyle: implicit
68
-
69
- Style/StringLiterals:
70
- EnforcedStyle: double_quotes
71
-
72
- # I prefer Yoda style instead, but there's no such enforcement style.
73
- Style/YodaCondition:
74
- Enabled: false
16
+ - gemfiles/**/*
17
+ - vendor/**/*
18
+ NewCops: enable
19
+ TargetRubyVersion: 2.6
data/.rubocop_todo.yml CHANGED
@@ -1,57 +1,32 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-09-10 23:47:55 +0000 using RuboCop version 0.58.2.
3
+ # on 2020-09-14 13:53:26 UTC using RuboCop version 0.90.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 5
10
- # Configuration parameters: CountComments.
11
- Metrics/MethodLength:
12
- Max: 13
13
-
14
- # Offense count: 25
15
- # Configuration parameters: Max.
16
- RSpec/ExampleLength:
17
- Exclude:
18
- - 'spec/sidekiq/throttled/communicator/callbacks_spec.rb'
19
- - 'spec/sidekiq/throttled/communicator/listener_spec.rb'
20
- - 'spec/sidekiq/throttled/communicator_spec.rb'
21
- - 'spec/sidekiq/throttled/fetch_spec.rb'
22
- - 'spec/sidekiq/throttled/queues_pauser_spec.rb'
23
- - 'spec/sidekiq/throttled/strategy_spec.rb'
24
- - 'spec/sidekiq/throttled/web/queues_spec.rb'
25
- - 'spec/sidekiq/throttled_spec.rb'
26
-
27
- # Offense count: 62
9
+ # Offense count: 68
28
10
  # Configuration parameters: .
29
11
  # SupportedStyles: have_received, receive
30
12
  RSpec/MessageSpies:
31
13
  EnforcedStyle: receive
32
14
 
33
- # Offense count: 20
34
- # Configuration parameters: AggregateFailuresByDefault.
15
+ # Offense count: 22
35
16
  RSpec/MultipleExpectations:
36
17
  Max: 4
37
18
 
38
- # Offense count: 33
19
+ # Offense count: 7
20
+ # Configuration parameters: AllowSubject.
21
+ RSpec/MultipleMemoizedHelpers:
22
+ Max: 6
23
+
24
+ # Offense count: 46
39
25
  RSpec/NestedGroups:
40
26
  Max: 5
41
27
 
42
- # Offense count: 3
28
+ # Offense count: 4
43
29
  RSpec/SubjectStub:
44
30
  Exclude:
45
31
  - 'spec/sidekiq/throttled/communicator_spec.rb'
46
32
  - 'spec/sidekiq/throttled/queues_pauser_spec.rb'
47
-
48
- # Offense count: 1
49
- # Configuration parameters: IgnoreSymbolicNames.
50
- RSpec/VerifiedDoubles:
51
- Exclude:
52
- - 'spec/sidekiq/throttled/registry_spec.rb'
53
-
54
- # Offense count: 1
55
- Security/MarshalLoad:
56
- Exclude:
57
- - 'lib/sidekiq/throttled/communicator/listener.rb'
data/.travis.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  language: ruby
2
- sudo: false
3
2
 
4
3
  services:
5
4
  - redis-server
@@ -23,6 +22,7 @@ rvm:
23
22
  - 2.4
24
23
  - 2.5
25
24
  - 2.6
25
+ - 2.7
26
26
 
27
27
  matrix:
28
28
  fast_finish: true
@@ -36,3 +36,4 @@ gemfile:
36
36
  - gemfiles/sidekiq_5.0.gemfile
37
37
  - gemfiles/sidekiq_5.1.gemfile
38
38
  - gemfiles/sidekiq_5.2.gemfile
39
+ - gemfiles/sidekiq_6.0.gemfile
data/Appraisals CHANGED
@@ -11,3 +11,19 @@ end
11
11
  appraise "sidekiq-5.2" do
12
12
  gem "sidekiq", "~> 5.2.0"
13
13
  end
14
+
15
+ appraise "sidekiq-6.0" do
16
+ gem "sidekiq", "~> 6.0.0"
17
+ end
18
+
19
+ appraise "sidekiq-6.1" do
20
+ gem "sidekiq", "~> 6.1.0"
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,46 @@
1
+ ## 0.15.0 (2021-12-16)
2
+
3
+ * [#102](https://github.com/sensortower/sidekiq-throttled/pull/102)
4
+ Support Ruby 3.0 and Sidekiq 6.2+.
5
+ ([@ybiquitous])
6
+
7
+ * [#97](https://github.com/sensortower/sidekiq-throttled/pull/97)
8
+ Fix kwargs usage in strategy collection.
9
+ ([@baptistejub])
10
+
11
+ ## 0.14.0 (2021-09-21)
12
+
13
+ * [#98](https://github.com/sensortower/sidekiq-throttled/pull/98)
14
+ Remove warning for strategy override.
15
+ ([@mattiagiuffrida-st])
16
+
17
+ * [#65](https://github.com/sensortower/sidekiq-throttled/pull/65)
18
+ Support composite (multi-key) strategies.
19
+ ([@holyketzer])
20
+
21
+ * [#89](https://github.com/sensortower/sidekiq-throttled/pull/89),
22
+ [#96](https://github.com/sensortower/sidekiq-throttled/pull/96), and
23
+ [#93](https://github.com/sensortower/sidekiq-throttled/pull/93)
24
+ Improve documentation.
25
+ ([@hubertjakubiak], [@khaile], and [@kylerippey])
26
+
27
+ ## 0.13.0 (2020-07-28)
28
+
29
+ * [#85](https://github.com/sensortower/sidekiq-throttled/pull/85)
30
+ Add Sidekiq 6.1+ support.
31
+ ([@hmaack])
32
+
33
+ ## 0.12.0 (2020-06-22)
34
+
35
+ * [#80](https://github.com/sensortower/sidekiq-throttled/pull/80)
36
+ Allow override cooldown timeout of queues with throttled jobs.
37
+ ([@vaot])
38
+
39
+ * [#76](https://github.com/sensortower/sidekiq-throttled/pull/76)
40
+ Fix warnings on Ruby 2.7
41
+ ([@lenon])
42
+
43
+
1
44
  ## 0.11.0 (2019-08-24)
2
45
 
3
46
  * [#59](https://github.com/sensortower/sidekiq-throttled/pull/59)
@@ -201,3 +244,13 @@
201
244
  [@mstruve]: https://github.com/mstruve
202
245
  [@ziaulrehman40]: https://github.com/ziaulrehman40
203
246
  [@ogins57]: https://github.com/ogins57
247
+ [@lenon]: https://github.com/lenon
248
+ [@vaot]: https://github.com/vaot
249
+ [@hmaack]: https://github.com/hmaack
250
+ [@holyketzer]: https://github.com/holyketzer
251
+ [@hubertjakubiak]: https://github.com/hubertjakubiak
252
+ [@kylerippey]: https://github.com/kylerippey
253
+ [@khaile]: https://github.com/khaile
254
+ [@mattiagiuffrida-st]: https://github.com/mattiagiuffrida-st
255
+ [@baptistejub]: https://github.com/baptistejub
256
+ [@ybiquitous]: https://github.com/ybiquitous
data/Gemfile CHANGED
@@ -5,8 +5,9 @@ source "https://rubygems.org"
5
5
  gem "appraisal"
6
6
  gem "rake"
7
7
  gem "rspec"
8
- gem "rubocop", "~> 0.58.0", :require => false
9
- gem "rubocop-rspec", "~> 1.29.1", :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
10
11
  gem "sidekiq"
11
12
 
12
13
  group :development do
@@ -17,13 +18,13 @@ group :development do
17
18
  end
18
19
 
19
20
  group :test do
21
+ gem "apparition"
20
22
  gem "capybara"
21
23
  gem "coveralls", :require => false
22
- gem "poltergeist"
23
24
  gem "puma"
24
25
  gem "rack-test"
25
- gem "simplecov", ">= 0.9"
26
- gem "sinatra", "~> 1.4", ">= 1.4.6"
26
+ gem "simplecov"
27
+ gem "sinatra"
27
28
  gem "timecop"
28
29
  end
29
30
 
data/LICENSE.md CHANGED
@@ -1,6 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2018 SensorTower Inc.
3
+ Copyright (c) 2020-2021 Alexey Zapparov, SensorTower Inc.
4
+ Copyright (c) 2015-2020 SensorTower Inc.
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal