sidekiq-throttled 0.17.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +314 -0
  3. data/lib/sidekiq/throttled/config.rb +44 -0
  4. data/lib/sidekiq/throttled/cooldown.rb +55 -0
  5. data/lib/sidekiq/throttled/expirable_set.rb +70 -0
  6. data/lib/sidekiq/throttled/job.rb +4 -4
  7. data/lib/sidekiq/throttled/middlewares/server.rb +28 -0
  8. data/lib/sidekiq/throttled/patches/basic_fetch.rb +53 -0
  9. data/lib/sidekiq/throttled/registry.rb +4 -7
  10. data/lib/sidekiq/throttled/strategy/concurrency.rb +4 -6
  11. data/lib/sidekiq/throttled/strategy/threshold.rb +4 -6
  12. data/lib/sidekiq/throttled/strategy.rb +10 -10
  13. data/lib/sidekiq/throttled/strategy_collection.rb +2 -3
  14. data/lib/sidekiq/throttled/version.rb +1 -1
  15. data/lib/sidekiq/throttled/web.rb +2 -45
  16. data/lib/sidekiq/throttled/worker.rb +1 -1
  17. data/lib/sidekiq/throttled.rb +45 -57
  18. metadata +25 -70
  19. data/.coveralls.yml +0 -1
  20. data/.github/dependabot.yml +0 -12
  21. data/.github/workflows/ci.yml +0 -52
  22. data/.gitignore +0 -12
  23. data/.rspec +0 -5
  24. data/.rubocop.yml +0 -20
  25. data/.rubocop_todo.yml +0 -68
  26. data/.travis.yml +0 -37
  27. data/.yardopts +0 -1
  28. data/Appraisals +0 -9
  29. data/CHANGES.md +0 -300
  30. data/Gemfile +0 -34
  31. data/Guardfile +0 -25
  32. data/README.md +0 -297
  33. data/Rakefile +0 -27
  34. data/gemfiles/sidekiq_6.4.gemfile +0 -33
  35. data/gemfiles/sidekiq_6.5.gemfile +0 -33
  36. data/lib/sidekiq/throttled/communicator/callbacks.rb +0 -72
  37. data/lib/sidekiq/throttled/communicator/exception_handler.rb +0 -25
  38. data/lib/sidekiq/throttled/communicator/listener.rb +0 -109
  39. data/lib/sidekiq/throttled/communicator.rb +0 -116
  40. data/lib/sidekiq/throttled/configuration.rb +0 -50
  41. data/lib/sidekiq/throttled/expirable_list.rb +0 -70
  42. data/lib/sidekiq/throttled/fetch/unit_of_work.rb +0 -83
  43. data/lib/sidekiq/throttled/fetch.rb +0 -94
  44. data/lib/sidekiq/throttled/middleware.rb +0 -22
  45. data/lib/sidekiq/throttled/patches/queue.rb +0 -18
  46. data/lib/sidekiq/throttled/queue_name.rb +0 -46
  47. data/lib/sidekiq/throttled/queues_pauser.rb +0 -152
  48. data/lib/sidekiq/throttled/testing.rb +0 -12
  49. data/lib/sidekiq/throttled/utils.rb +0 -19
  50. data/lib/sidekiq/throttled/web/queues.html.erb +0 -49
  51. data/lib/sidekiq/throttled/web/summary_fix.js +0 -10
  52. data/lib/sidekiq/throttled/web/summary_fix.rb +0 -35
  53. data/rubocop/layout.yml +0 -24
  54. data/rubocop/lint.yml +0 -41
  55. data/rubocop/metrics.yml +0 -4
  56. data/rubocop/performance.yml +0 -25
  57. data/rubocop/rspec.yml +0 -3
  58. data/rubocop/style.yml +0 -84
  59. data/sidekiq-throttled.gemspec +0 -36
  60. /data/{LICENSE.md → LICENSE.txt} +0 -0
data/.rubocop_todo.yml DELETED
@@ -1,68 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2022-06-13 00:11:28 UTC using RuboCop version 1.30.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 3
10
- # Configuration parameters: AllowComments, AllowEmptyLambdas.
11
- Lint/EmptyBlock:
12
- Exclude:
13
- - 'spec/sidekiq/throttled/middleware_spec.rb'
14
- - 'spec/sidekiq/throttled/registry_spec.rb'
15
-
16
- # Offense count: 2
17
- # Configuration parameters: EnforcedStyleForLeadingUnderscores.
18
- # SupportedStylesForLeadingUnderscores: disallowed, required, optional
19
- Naming/MemoizedInstanceVariableName:
20
- Exclude:
21
- - 'lib/sidekiq/throttled/communicator.rb'
22
- - 'lib/sidekiq/throttled/queues_pauser.rb'
23
-
24
- # Offense count: 2
25
- Performance/MethodObjectAsBlock:
26
- Exclude:
27
- - 'lib/sidekiq/throttled/queues_pauser.rb'
28
-
29
- # Offense count: 2
30
- # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
31
- # Include: **/*_spec*rb*, **/spec/**/*
32
- RSpec/FilePath:
33
- Exclude:
34
- - 'spec/sidekiq/throttled/web/queues_spec.rb'
35
- - 'spec/sidekiq/throttled/web/throttled_spec.rb'
36
-
37
- # Offense count: 69
38
- # Configuration parameters: .
39
- # SupportedStyles: have_received, receive
40
- RSpec/MessageSpies:
41
- EnforcedStyle: receive
42
-
43
- # Offense count: 22
44
- RSpec/MultipleExpectations:
45
- Max: 4
46
-
47
- # Offense count: 7
48
- # Configuration parameters: AllowSubject.
49
- RSpec/MultipleMemoizedHelpers:
50
- Max: 6
51
-
52
- # Offense count: 46
53
- RSpec/NestedGroups:
54
- Max: 5
55
-
56
- # Offense count: 5
57
- RSpec/StubbedMock:
58
- Exclude:
59
- - 'spec/sidekiq/throttled/expirable_list_spec.rb'
60
- - 'spec/sidekiq/throttled/fetch_spec.rb'
61
- - 'spec/sidekiq/throttled/queues_pauser_spec.rb'
62
-
63
- # Offense count: 6
64
- RSpec/SubjectStub:
65
- Exclude:
66
- - 'spec/sidekiq/throttled/communicator_spec.rb'
67
- - 'spec/sidekiq/throttled/fetch_spec.rb'
68
- - 'spec/sidekiq/throttled/queues_pauser_spec.rb'
data/.travis.yml DELETED
@@ -1,37 +0,0 @@
1
- language: ruby
2
-
3
- services:
4
- - redis-server
5
-
6
- cache: bundler
7
-
8
- before_install:
9
- - gem update --system
10
- - gem --version
11
- - gem install bundler
12
- - bundle --version
13
- # Install pahantomjs
14
- - mkdir travis-phantomjs
15
- - wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
16
- - tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs
17
- - export PATH=$PWD/travis-phantomjs:$PATH
18
-
19
- install: bundle install --without development
20
-
21
- rvm:
22
- - 2.4
23
- - 2.5
24
- - 2.6
25
- - 2.7
26
-
27
- matrix:
28
- fast_finish: true
29
- include:
30
- -
31
- rvm: 2.4
32
- env: SUITE="rubocop"
33
- gemfile: Gemfile
34
-
35
- gemfile:
36
- - gemfiles/sidekiq_6.4.gemfile
37
- - gemfiles/sidekiq_6.5.gemfile
data/.yardopts DELETED
@@ -1 +0,0 @@
1
- --no-private - LICENSE.md
data/Appraisals DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- appraise "sidekiq-6.4" do
4
- gem "sidekiq", "~> 6.4.0"
5
- end
6
-
7
- appraise "sidekiq-6.5" do
8
- gem "sidekiq", "~> 6.5.0"
9
- end
data/CHANGES.md DELETED
@@ -1,300 +0,0 @@
1
- ## 0.16.1 (2022-06-14)
2
-
3
- * [#2](https://github.com/ixti/sidekiq-throttled/pull/2)
4
- Support custom ActiveJob adapters.
5
- ([@longkt90])
6
-
7
- * [#107](https://github.com/sensortower/sidekiq-throttled/pull/107)
8
- Log error when key sufix extraction fails.
9
- ([@pjungwir])
10
-
11
- ## 0.16.0 (2022-06-13)
12
-
13
- * Drop Ruby 2.6 support.
14
-
15
- * Drop Sidekiq 5.X support.
16
-
17
- * [#121](https://github.com/sensortower/sidekiq-throttled/pull/121)
18
- Sidekiq 6.5 compatibility.
19
- ([@hieuk09])
20
-
21
- * [#116](https://github.com/sensortower/sidekiq-throttled/pull/116)
22
- Unwrap ActiveJob JobWrapper
23
- ([@holstvoogd])
24
-
25
- * [#115](https://github.com/sensortower/sidekiq-throttled/pull/115)
26
- Fix Redis 4.6 deprecation warnings.
27
- ([@dbackeus])
28
-
29
- * [#113](https://github.com/sensortower/sidekiq-throttled/pull/113)
30
- Add Ruby 3.1 to CI.
31
- ([@petergoldstein])
32
-
33
- * [#103](https://github.com/sensortower/sidekiq-throttled/pull/103)
34
- Rename Sidekiq::Throttled::Worker to Sidekiq::Throttled::Job, and alias it
35
- as Sidekiq::Throttled::Worker.
36
- ([@CHTJonas])
37
-
38
- ## 0.15.0 (2021-12-16)
39
-
40
- * [#102](https://github.com/sensortower/sidekiq-throttled/pull/102)
41
- Support Ruby 3.0 and Sidekiq 6.2+.
42
- ([@ybiquitous])
43
-
44
- * [#97](https://github.com/sensortower/sidekiq-throttled/pull/97)
45
- Fix kwargs usage in strategy collection.
46
- ([@baptistejub])
47
-
48
- ## 0.14.0 (2021-09-21)
49
-
50
- * [#98](https://github.com/sensortower/sidekiq-throttled/pull/98)
51
- Remove warning for strategy override.
52
- ([@mattiagiuffrida-st])
53
-
54
- * [#65](https://github.com/sensortower/sidekiq-throttled/pull/65)
55
- Support composite (multi-key) strategies.
56
- ([@holyketzer])
57
-
58
- * [#89](https://github.com/sensortower/sidekiq-throttled/pull/89),
59
- [#96](https://github.com/sensortower/sidekiq-throttled/pull/96), and
60
- [#93](https://github.com/sensortower/sidekiq-throttled/pull/93)
61
- Improve documentation.
62
- ([@hubertjakubiak], [@khaile], and [@kylerippey])
63
-
64
- ## 0.13.0 (2020-07-28)
65
-
66
- * [#85](https://github.com/sensortower/sidekiq-throttled/pull/85)
67
- Add Sidekiq 6.1+ support.
68
- ([@hmaack])
69
-
70
- ## 0.12.0 (2020-06-22)
71
-
72
- * [#80](https://github.com/sensortower/sidekiq-throttled/pull/80)
73
- Allow override cooldown timeout of queues with throttled jobs.
74
- ([@vaot])
75
-
76
- * [#76](https://github.com/sensortower/sidekiq-throttled/pull/76)
77
- Fix warnings on Ruby 2.7
78
- ([@lenon])
79
-
80
-
81
- ## 0.11.0 (2019-08-24)
82
-
83
- * [#59](https://github.com/sensortower/sidekiq-throttled/pull/59)
84
- Add throttling observer.
85
- ([@ogins57])
86
-
87
-
88
- ## 0.10.0 (2019-06-22)
89
-
90
- * [#60](https://github.com/sensortower/sidekiq-throttled/pull/60)
91
- Skip throttling check in redis if limit is 0.
92
- ([@mstruve])
93
-
94
- * [#58](https://github.com/sensortower/sidekiq-throttled/pull/58)
95
- Improve documentation bout TTL.
96
- ([@ziaulrehman40])
97
-
98
- * Improve reliability of paused queues, by resyncing list of paused queues
99
- on schedule.
100
- ([@ixti])
101
-
102
-
103
- ## 0.9.0 (2018-09-11)
104
-
105
- * Add support of Sidekiq 5.2.x
106
- ([@ixti])
107
-
108
- * Drop support of Sidekiq 4.x
109
- ([@ixti])
110
-
111
- * Add concurrent-ruby as dependency which is no longer a dependency of
112
- Sidekiq as 5.2+ version.
113
- ([@ixti])
114
-
115
-
116
- ## 0.8.2 (2018-02-14)
117
-
118
- * Extract redis LUA scripts stored procedures runner to redis-prescription gem.
119
- ([@ixti])
120
-
121
- * Switch to Concurrent.monotonic_time to expire elements of ExpirableList.
122
- ([@ixti])
123
-
124
-
125
- ## 0.8.1 (2017-11-02)
126
-
127
- * Preload job class constant prior trying to get it's throttling strategy.
128
- ([@ixti])
129
-
130
-
131
- ## 0.8.0 (2017-10-11)
132
-
133
- * Refactor concurrency throttling internals to use sorted sets in order to avoid
134
- starvation in case when finalize! was not called (OOM / redis issues).
135
- ([@ixti])
136
-
137
-
138
- ## 0.7.3 (2017-06-26)
139
-
140
- * [#34](https://github.com/sensortower/sidekiq-throttled/issues/34)
141
- Fix reset button for sidekiq `>= 4.2`.
142
- ([@ixti])
143
-
144
-
145
- ## 0.7.2 (2017-04-02)
146
-
147
- * Fix summary bar fixer on sidekiq 4.2+.
148
- ([@ixti])
149
-
150
- * Fix regexp used to fix summay bar queues link when ui was enhanced.
151
- ([@ixti])
152
-
153
-
154
- ## 0.7.1 (2017-03-30)
155
-
156
- * Fix summary bar queues link when queue ui was enhanced.
157
- ([@ixti])
158
-
159
- * [#31](https://github.com/sensortower/sidekiq-throttled/pull/31)
160
- [#30](https://github.com/sensortower/sidekiq-throttled/issues/30)
161
- Do not throttle if limit is `nil`.
162
- ([@ixti])
163
-
164
-
165
- ## 0.7.0 (2017-03-22)
166
-
167
- * Expose pause/resume queues hidden feature to UI. This was available via API
168
- since v0.6.0 and today it's finally got it's UI.
169
- ([@ixti])
170
-
171
-
172
- ## 0.6.7 (2017-03-21)
173
-
174
- * Fix fetcher causing workers starvation upon low concurrency thresholds.
175
- ([@ixti])
176
-
177
-
178
- ## 0.6.6 (2016-10-16)
179
-
180
- * [#24](https://github.com/sensortower/sidekiq-throttled/pull/24)
181
- Fix dynamic `:key_suffix` issue.
182
- ([@iporsut])
183
-
184
-
185
- ## 0.6.5 (2016-09-04)
186
-
187
- * Fix concurrency throttling when redis-namespace is used.
188
- ([@ixti])
189
-
190
-
191
- ## 0.6.4 (2016-09-02)
192
-
193
- * Rename UnitOfWork throttled requeue to `#requeue_throttled`.
194
- ([@ixti])
195
-
196
-
197
- ## 0.6.3 (2016-09-02)
198
-
199
- * Enrich internal API to allow better extensibility.
200
- ([@ixti])
201
-
202
-
203
- ## 0.6.2 (2016-09-01)
204
-
205
- * Add `Fetch.bulk_requeue` used by Sidekiq upon termination.
206
- ([@ixti])
207
-
208
-
209
- ## 0.6.1 (2016-08-30)
210
-
211
- * Trivial internal API change: extracted queues list builder of `Fetch` into
212
- dedicated internal method, allowing to enhance it with extra custom filters.
213
- ([@ixti])
214
-
215
-
216
- ## 0.6.0 (2016-08-27)
217
-
218
- * [#21](https://github.com/sensortower/sidekiq-throttled/pull/21)
219
- Allow pause/unpause queues.
220
- ([@ixti])
221
-
222
-
223
- ## 0.5.0 (2016-08-18)
224
-
225
- * Drop Sidekiq 3.x support.
226
- ([@ixti])
227
-
228
-
229
- ## 0.4.1 (2016-08-18)
230
-
231
- * [#15](https://github.com/sensortower/sidekiq-throttled/pull/15)
232
- Fix throttled web UI on older versions of sidekiq.
233
- ([@palanglung])
234
-
235
-
236
- ## 0.4.0 (2016-05-17)
237
-
238
- * [#14](https://github.com/sensortower/sidekiq-throttled/pull/14)
239
- Support dynamic configuration of limits and periods.
240
- ([@azach], [@ixti])
241
-
242
-
243
- ## 0.3.2 (2016-05-16)
244
-
245
- * [#13](https://github.com/sensortower/sidekiq-throttled/issues/13)
246
- Fix throttled BasicFetch with strictly ordered queues on sidekiq 4.
247
- ([@palanglung], [@ixti])
248
-
249
-
250
- ## 0.3.1 (2016-05-15)
251
-
252
- * Precalculate LUA script digests to reduce bandwidth upon nodes reload
253
- _(which might (and might not) happen if you run thousands of nodes)_.
254
- ([@ixti])
255
-
256
-
257
- ## 0.3.0 (2016-05-02)
258
-
259
- * [#1](https://github.com/sensortower/sidekiq-throttled/issues/1):
260
- Add Sidekiq 4.0 support.
261
- ([@ixti])
262
-
263
-
264
- ## 0.2.0 (2016-02-29)
265
-
266
- * [#6](https://github.com/sensortower/sidekiq-throttled/pull/6):
267
- Add dynamic key suffix functionality.
268
- ([@fhwang])
269
-
270
-
271
- ## 0.1.0 (2015-11-03)
272
-
273
- * Initial release.
274
-
275
-
276
- [@ixti]: https://github.com/ixti
277
- [@fhwang]: https://github.com/fhwang
278
- [@palanglung]: https://github.com/palanglung
279
- [@azach]: https://github.com/azach
280
- [@iporsut]: https://github.com/iporsut
281
- [@mstruve]: https://github.com/mstruve
282
- [@ziaulrehman40]: https://github.com/ziaulrehman40
283
- [@ogins57]: https://github.com/ogins57
284
- [@lenon]: https://github.com/lenon
285
- [@vaot]: https://github.com/vaot
286
- [@hmaack]: https://github.com/hmaack
287
- [@holyketzer]: https://github.com/holyketzer
288
- [@hubertjakubiak]: https://github.com/hubertjakubiak
289
- [@kylerippey]: https://github.com/kylerippey
290
- [@khaile]: https://github.com/khaile
291
- [@mattiagiuffrida-st]: https://github.com/mattiagiuffrida-st
292
- [@baptistejub]: https://github.com/baptistejub
293
- [@ybiquitous]: https://github.com/ybiquitous
294
- [@hieuk09]: https://github.com/hieuk09
295
- [@petergoldstein]: https://github.com/petergoldstein
296
- [@dbackeus]: https://github.com/dbackeus
297
- [@holstvoogd]: https://github.com/holstvoogd
298
- [@CHTJonas]: https://github.com/CHTJonas
299
- [@pjungwir]: https://github.com/pjungwir
300
- [@longkt90]: https://github.com/longkt90
data/Gemfile DELETED
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "appraisal"
6
- gem "rake"
7
- gem "rspec"
8
- gem "sidekiq"
9
-
10
- group :development do
11
- gem "byebug"
12
- gem "guard", :require => false
13
- gem "guard-rspec", :require => false
14
- gem "guard-rubocop", :require => false
15
- end
16
-
17
- group :test do
18
- gem "apparition"
19
- gem "capybara"
20
- gem "puma"
21
- gem "rack-test"
22
- gem "sinatra"
23
- gem "timecop"
24
- end
25
-
26
- group :lint do
27
- gem "rubocop", :require => false
28
- gem "rubocop-performance", :require => false
29
- gem "rubocop-rake", :require => false
30
- gem "rubocop-rspec", :require => false
31
- end
32
-
33
- # Specify your gem's dependencies in sidekiq-throttled.gemspec
34
- gemspec
data/Guardfile DELETED
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- group :red_green_refactor, :halt_on_fail => true do
4
- guard :rspec, :cmd => "bundle exec rspec --no-profile" do
5
- require "guard/rspec/dsl"
6
- dsl = Guard::RSpec::Dsl.new(self)
7
-
8
- # Feel free to open issues for suggestions and improvements
9
-
10
- # RSpec files
11
- rspec = dsl.rspec
12
- watch(rspec.spec_helper) { rspec.spec_dir }
13
- watch(rspec.spec_support) { rspec.spec_dir }
14
- watch(rspec.spec_files)
15
-
16
- # Ruby files
17
- ruby = dsl.ruby
18
- dsl.watch_spec_files_for(ruby.lib_files)
19
- end
20
-
21
- guard :rubocop, :all_on_start => false do
22
- watch(%r{.+\.rb$})
23
- watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
24
- end
25
- end