sidekiq-throttled 0.10.0 → 0.14.1

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +54 -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 +8 -0
  13. data/CHANGES.md +28 -0
  14. data/Gemfile +6 -5
  15. data/LICENSE.md +1 -1
  16. data/README.md +75 -15
  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/lib/sidekiq/throttled/communicator/callbacks.rb +7 -6
  23. data/lib/sidekiq/throttled/communicator/listener.rb +3 -3
  24. data/lib/sidekiq/throttled/expirable_list.rb +1 -1
  25. data/lib/sidekiq/throttled/fetch.rb +34 -20
  26. data/lib/sidekiq/throttled/queue_name.rb +1 -1
  27. data/lib/sidekiq/throttled/registry.rb +2 -5
  28. data/lib/sidekiq/throttled/strategy/concurrency.rb +5 -5
  29. data/lib/sidekiq/throttled/strategy/threshold.rb +6 -5
  30. data/lib/sidekiq/throttled/strategy.rb +23 -14
  31. data/lib/sidekiq/throttled/strategy_collection.rb +70 -0
  32. data/lib/sidekiq/throttled/utils.rb +1 -1
  33. data/lib/sidekiq/throttled/version.rb +1 -1
  34. data/lib/sidekiq/throttled/web/stats.rb +2 -6
  35. data/lib/sidekiq/throttled/web/summary_fix.rb +3 -2
  36. data/lib/sidekiq/throttled/web/throttled.html.erb +6 -2
  37. data/lib/sidekiq/throttled/web.rb +1 -1
  38. data/lib/sidekiq/throttled/worker.rb +2 -2
  39. data/lib/sidekiq/throttled.rb +14 -2
  40. data/sidekiq-throttled.gemspec +2 -0
  41. metadata +18 -8
@@ -61,8 +61,7 @@ module Sidekiq
61
61
  QueuesPauser.instance.setup!
62
62
 
63
63
  Sidekiq.configure_server do |config|
64
- require "sidekiq/throttled/fetch"
65
- Sidekiq.options[:fetch] = Sidekiq::Throttled::Fetch
64
+ setup_strategy!
66
65
 
67
66
  require "sidekiq/throttled/middleware"
68
67
  config.server_middleware do |chain|
@@ -93,6 +92,19 @@ module Sidekiq
93
92
 
94
93
  private
95
94
 
95
+ # @return [void]
96
+ def setup_strategy!
97
+ require "sidekiq/throttled/fetch"
98
+
99
+ # https://github.com/mperham/sidekiq/commit/fce05c9d4b4c0411c982078a4cf3a63f20f739bc
100
+ Sidekiq.options[:fetch] =
101
+ if Gem::Version.new(Sidekiq::VERSION) < Gem::Version.new("6.1.0")
102
+ Sidekiq::Throttled::Fetch
103
+ else
104
+ Sidekiq::Throttled::Fetch.new(Sidekiq.options)
105
+ end
106
+ end
107
+
96
108
  # Tries to preload constant by it's name once.
97
109
  #
98
110
  # Somehow, sometimes, some classes are not eager loaded upon Rails init,
@@ -24,6 +24,8 @@ 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"
28
+
27
29
  spec.add_runtime_dependency "concurrent-ruby"
28
30
  spec.add_runtime_dependency "redis-prescription"
29
31
  spec.add_runtime_dependency "sidekiq"
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.10.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey V Zapparov
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-24 00:00:00.000000000 Z
11
+ date: 2021-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -74,9 +74,16 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - ".coveralls.yml"
77
+ - ".github/workflows/ci.yml"
77
78
  - ".gitignore"
78
79
  - ".rspec"
79
80
  - ".rubocop.yml"
81
+ - ".rubocop/layout.yml"
82
+ - ".rubocop/lint.yml"
83
+ - ".rubocop/metrics.yml"
84
+ - ".rubocop/performance.yml"
85
+ - ".rubocop/rspec.yml"
86
+ - ".rubocop/style.yml"
80
87
  - ".rubocop_todo.yml"
81
88
  - ".travis.yml"
82
89
  - ".yardopts"
@@ -90,6 +97,8 @@ files:
90
97
  - gemfiles/sidekiq_5.0.gemfile
91
98
  - gemfiles/sidekiq_5.1.gemfile
92
99
  - gemfiles/sidekiq_5.2.gemfile
100
+ - gemfiles/sidekiq_6.0.gemfile
101
+ - gemfiles/sidekiq_6.1.gemfile
93
102
  - lib/sidekiq/throttled.rb
94
103
  - lib/sidekiq/throttled/communicator.rb
95
104
  - lib/sidekiq/throttled/communicator/callbacks.rb
@@ -110,6 +119,7 @@ files:
110
119
  - lib/sidekiq/throttled/strategy/concurrency.rb
111
120
  - lib/sidekiq/throttled/strategy/threshold.lua
112
121
  - lib/sidekiq/throttled/strategy/threshold.rb
122
+ - lib/sidekiq/throttled/strategy_collection.rb
113
123
  - lib/sidekiq/throttled/testing.rb
114
124
  - lib/sidekiq/throttled/utils.rb
115
125
  - lib/sidekiq/throttled/version.rb
@@ -125,23 +135,23 @@ homepage: https://github.com/sensortower/sidekiq-throttled
125
135
  licenses:
126
136
  - MIT
127
137
  metadata: {}
128
- post_install_message:
138
+ post_install_message:
129
139
  rdoc_options: []
130
140
  require_paths:
131
141
  - lib
132
142
  required_ruby_version: !ruby/object:Gem::Requirement
133
143
  requirements:
134
- - - ">="
144
+ - - "~>"
135
145
  - !ruby/object:Gem::Version
136
- version: '0'
146
+ version: '2.6'
137
147
  required_rubygems_version: !ruby/object:Gem::Requirement
138
148
  requirements:
139
149
  - - ">="
140
150
  - !ruby/object:Gem::Version
141
151
  version: '0'
142
152
  requirements: []
143
- rubygems_version: 3.0.3
144
- signing_key:
153
+ rubygems_version: 3.1.4
154
+ signing_key:
145
155
  specification_version: 4
146
156
  summary: Concurrency and threshold throttling for Sidekiq.
147
157
  test_files: []