sidekiq-throttled 0.18.0 → 1.1.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.
- checksums.yaml +4 -4
- data/README.adoc +314 -0
- data/lib/sidekiq/throttled/config.rb +44 -0
- data/lib/sidekiq/throttled/cooldown.rb +55 -0
- data/lib/sidekiq/throttled/expirable_set.rb +70 -0
- data/lib/sidekiq/throttled/job.rb +4 -4
- data/lib/sidekiq/throttled/middlewares/server.rb +28 -0
- data/lib/sidekiq/throttled/patches/basic_fetch.rb +53 -0
- data/lib/sidekiq/throttled/registry.rb +4 -7
- data/lib/sidekiq/throttled/strategy/concurrency.rb +2 -4
- data/lib/sidekiq/throttled/strategy/threshold.rb +2 -4
- data/lib/sidekiq/throttled/strategy.rb +10 -10
- data/lib/sidekiq/throttled/strategy_collection.rb +2 -3
- data/lib/sidekiq/throttled/version.rb +1 -1
- data/lib/sidekiq/throttled/web.rb +2 -45
- data/lib/sidekiq/throttled/worker.rb +1 -1
- data/lib/sidekiq/throttled.rb +45 -57
- metadata +22 -67
- data/.coveralls.yml +0 -1
- data/.github/dependabot.yml +0 -12
- data/.github/workflows/ci.yml +0 -52
- data/.gitignore +0 -12
- data/.rspec +0 -5
- data/.rubocop.yml +0 -20
- data/.rubocop_todo.yml +0 -68
- data/.travis.yml +0 -37
- data/.yardopts +0 -1
- data/Appraisals +0 -9
- data/CHANGES.md +0 -318
- data/Gemfile +0 -34
- data/Guardfile +0 -25
- data/README.md +0 -297
- data/Rakefile +0 -27
- data/gemfiles/sidekiq_6.4.gemfile +0 -33
- data/gemfiles/sidekiq_6.5.gemfile +0 -33
- data/lib/sidekiq/throttled/communicator/callbacks.rb +0 -72
- data/lib/sidekiq/throttled/communicator/exception_handler.rb +0 -25
- data/lib/sidekiq/throttled/communicator/listener.rb +0 -109
- data/lib/sidekiq/throttled/communicator.rb +0 -116
- data/lib/sidekiq/throttled/configuration.rb +0 -50
- data/lib/sidekiq/throttled/expirable_list.rb +0 -70
- data/lib/sidekiq/throttled/fetch/unit_of_work.rb +0 -83
- data/lib/sidekiq/throttled/fetch.rb +0 -94
- data/lib/sidekiq/throttled/middleware.rb +0 -22
- data/lib/sidekiq/throttled/patches/queue.rb +0 -18
- data/lib/sidekiq/throttled/queue_name.rb +0 -46
- data/lib/sidekiq/throttled/queues_pauser.rb +0 -152
- data/lib/sidekiq/throttled/testing.rb +0 -12
- data/lib/sidekiq/throttled/utils.rb +0 -19
- data/lib/sidekiq/throttled/web/queues.html.erb +0 -49
- data/lib/sidekiq/throttled/web/summary_fix.js +0 -10
- data/lib/sidekiq/throttled/web/summary_fix.rb +0 -35
- data/rubocop/layout.yml +0 -24
- data/rubocop/lint.yml +0 -41
- data/rubocop/metrics.yml +0 -4
- data/rubocop/performance.yml +0 -25
- data/rubocop/rspec.yml +0 -3
- data/rubocop/style.yml +0 -84
- data/sidekiq-throttled.gemspec +0 -36
- /data/{LICENSE.md → LICENSE.txt} +0 -0
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# internal
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
require_relative "./errors"
|
5
|
+
require_relative "./strategy_collection"
|
6
|
+
require_relative "./strategy/concurrency"
|
7
|
+
require_relative "./strategy/threshold"
|
8
8
|
|
9
9
|
module Sidekiq
|
10
10
|
module Throttled
|
@@ -35,14 +35,14 @@ module Sidekiq
|
|
35
35
|
@observer = observer
|
36
36
|
|
37
37
|
@concurrency = StrategyCollection.new(concurrency,
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
38
|
+
strategy: Concurrency,
|
39
|
+
name: name,
|
40
|
+
key_suffix: key_suffix)
|
41
41
|
|
42
42
|
@threshold = StrategyCollection.new(threshold,
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
43
|
+
strategy: Threshold,
|
44
|
+
name: name,
|
45
|
+
key_suffix: key_suffix)
|
46
46
|
|
47
47
|
return if @concurrency.any? || @threshold.any?
|
48
48
|
|
@@ -19,8 +19,7 @@ module Sidekiq
|
|
19
19
|
# @param [#to_s] name
|
20
20
|
# @param [#call] key_suffix Dynamic key suffix generator.
|
21
21
|
def initialize(strategies, strategy:, name:, key_suffix:)
|
22
|
-
strategies = (strategies.is_a?(Hash) ? [strategies] : Array(strategies))
|
23
|
-
@strategies = strategies.map do |options|
|
22
|
+
@strategies = (strategies.is_a?(Hash) ? [strategies] : Array(strategies)).map do |options|
|
24
23
|
make_strategy(strategy, name, key_suffix, options)
|
25
24
|
end
|
26
25
|
end
|
@@ -61,7 +60,7 @@ module Sidekiq
|
|
61
60
|
return unless options
|
62
61
|
|
63
62
|
strategy.new("throttled:#{name}",
|
64
|
-
:
|
63
|
+
key_suffix: key_suffix,
|
65
64
|
**options)
|
66
65
|
end
|
67
66
|
end
|
@@ -8,9 +8,8 @@ require "sidekiq"
|
|
8
8
|
require "sidekiq/web"
|
9
9
|
|
10
10
|
# internal
|
11
|
-
|
12
|
-
|
13
|
-
require "sidekiq/throttled/web/summary_fix"
|
11
|
+
require_relative "./registry"
|
12
|
+
require_relative "./web/stats"
|
14
13
|
|
15
14
|
module Sidekiq
|
16
15
|
module Throttled
|
@@ -18,31 +17,11 @@ module Sidekiq
|
|
18
17
|
module Web
|
19
18
|
VIEWS = Pathname.new(__dir__).join("web")
|
20
19
|
THROTTLED_TPL = VIEWS.join("throttled.html.erb").read.freeze
|
21
|
-
QUEUES_TPL = VIEWS.join("queues.html.erb").read.freeze
|
22
20
|
|
23
21
|
class << self
|
24
|
-
# Replace default Queues tab with enhanced one.
|
25
|
-
def enhance_queues_tab!
|
26
|
-
SummaryFix.enabled = true
|
27
|
-
Sidekiq::Web::DEFAULT_TABS["Queues"] = "enhanced-queues"
|
28
|
-
Sidekiq::Web.tabs.delete("Enhanced Queues")
|
29
|
-
end
|
30
|
-
|
31
|
-
# Restore original Queues tab.
|
32
|
-
#
|
33
|
-
# @api There's next to absolutely no value in this method for real
|
34
|
-
# users. The only it's purpose is to restore virgin state in specs.
|
35
|
-
def restore_queues_tab!
|
36
|
-
SummaryFix.enabled = false
|
37
|
-
Sidekiq::Web::DEFAULT_TABS["Queues"] = "queues"
|
38
|
-
Sidekiq::Web.tabs["Enhanced Queues"] = "enhanced-queues"
|
39
|
-
end
|
40
|
-
|
41
22
|
# @api private
|
42
23
|
def registered(app)
|
43
|
-
SummaryFix.apply! app
|
44
24
|
register_throttled_tab app
|
45
|
-
register_enhanced_queues_tab app
|
46
25
|
end
|
47
26
|
|
48
27
|
private
|
@@ -55,27 +34,6 @@ module Sidekiq
|
|
55
34
|
redirect "#{root_path}throttled"
|
56
35
|
end
|
57
36
|
end
|
58
|
-
|
59
|
-
# rubocop:disable Metrics/AbcSize
|
60
|
-
def register_enhanced_queues_tab(app) # rubocop:disable Metrics/MethodLength
|
61
|
-
pauser = QueuesPauser.instance
|
62
|
-
|
63
|
-
app.get("/enhanced-queues") do
|
64
|
-
@queues = Sidekiq::Queue.all
|
65
|
-
erb QUEUES_TPL.dup
|
66
|
-
end
|
67
|
-
|
68
|
-
app.post("/enhanced-queues/:name") do
|
69
|
-
case params[:action]
|
70
|
-
when "delete" then Sidekiq::Queue.new(params[:name]).clear
|
71
|
-
when "pause" then pauser.pause!(params[:name])
|
72
|
-
else pauser.resume!(params[:name])
|
73
|
-
end
|
74
|
-
|
75
|
-
redirect "#{root_path}enhanced-queues"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
# rubocop:enable Metrics/AbcSize
|
79
37
|
end
|
80
38
|
end
|
81
39
|
end
|
@@ -83,4 +41,3 @@ end
|
|
83
41
|
|
84
42
|
Sidekiq::Web.register Sidekiq::Throttled::Web
|
85
43
|
Sidekiq::Web.tabs["Throttled"] = "throttled"
|
86
|
-
Sidekiq::Web.tabs["Enhanced Queues"] = "enhanced-queues"
|
data/lib/sidekiq/throttled.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# 3rd party
|
4
3
|
require "sidekiq"
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
require "sidekiq/throttled/utils"
|
5
|
+
require_relative "./throttled/config"
|
6
|
+
require_relative "./throttled/cooldown"
|
7
|
+
require_relative "./throttled/job"
|
8
|
+
require_relative "./throttled/middlewares/server"
|
9
|
+
require_relative "./throttled/patches/basic_fetch"
|
10
|
+
require_relative "./throttled/registry"
|
11
|
+
require_relative "./throttled/version"
|
12
|
+
require_relative "./throttled/worker"
|
15
13
|
|
16
14
|
# @see https://github.com/mperham/sidekiq/
|
17
15
|
module Sidekiq
|
@@ -20,7 +18,6 @@ module Sidekiq
|
|
20
18
|
# Just add somewhere in your bootstrap:
|
21
19
|
#
|
22
20
|
# require "sidekiq/throttled"
|
23
|
-
# Sidekiq::Throttled.setup!
|
24
21
|
#
|
25
22
|
# Once you've done that you can include {Sidekiq::Throttled::Job} to your
|
26
23
|
# job classes and configure throttling:
|
@@ -46,28 +43,29 @@ module Sidekiq
|
|
46
43
|
MUTEX = Mutex.new
|
47
44
|
private_constant :MUTEX
|
48
45
|
|
49
|
-
|
50
|
-
|
46
|
+
@config = Config.new.freeze
|
47
|
+
@cooldown = Cooldown[@config]
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
49
|
+
class << self
|
50
|
+
# @api internal
|
51
|
+
#
|
52
|
+
# @return [Cooldown, nil]
|
53
|
+
attr_reader :cooldown
|
56
54
|
|
57
|
-
#
|
55
|
+
# @example
|
56
|
+
# Sidekiq::Throttled.configure do |config|
|
57
|
+
# config.cooldown_period = nil # Disable queues cooldown manager
|
58
|
+
# end
|
58
59
|
#
|
59
|
-
# @
|
60
|
-
def
|
61
|
-
|
62
|
-
|
60
|
+
# @yieldparam config [Config]
|
61
|
+
def configure
|
62
|
+
MUTEX.synchronize do
|
63
|
+
config = @config.dup
|
63
64
|
|
64
|
-
|
65
|
-
setup_strategy!(config)
|
65
|
+
yield config
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
chain.add Sidekiq::Throttled::Middleware
|
70
|
-
end
|
67
|
+
@config = config.freeze
|
68
|
+
@cooldown = Cooldown[@config]
|
71
69
|
end
|
72
70
|
end
|
73
71
|
|
@@ -76,13 +74,13 @@ module Sidekiq
|
|
76
74
|
# @param [String] message Job's JSON payload
|
77
75
|
# @return [Boolean]
|
78
76
|
def throttled?(message)
|
79
|
-
message =
|
80
|
-
job
|
81
|
-
jid
|
77
|
+
message = Sidekiq.load_json(message)
|
78
|
+
job = message.fetch("wrapped") { message["class"] }
|
79
|
+
jid = message["jid"]
|
82
80
|
|
83
|
-
|
81
|
+
return false unless job && jid
|
84
82
|
|
85
|
-
Registry.get
|
83
|
+
Registry.get(job) do |strategy|
|
86
84
|
return strategy.throttled?(jid, *message["args"])
|
87
85
|
end
|
88
86
|
|
@@ -91,33 +89,23 @@ module Sidekiq
|
|
91
89
|
false
|
92
90
|
end
|
93
91
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
def setup_strategy!(sidekiq_config)
|
98
|
-
require "sidekiq/throttled/fetch"
|
99
|
-
|
100
|
-
# https://github.com/mperham/sidekiq/commit/67daa7a408b214d593100f782271ed108686c147
|
101
|
-
sidekiq_config = sidekiq_config.options if Gem::Version.new(Sidekiq::VERSION) < Gem::Version.new("6.5.0")
|
102
|
-
|
103
|
-
sidekiq_config[:fetch] = Sidekiq::Throttled::Fetch.new(sidekiq_config)
|
104
|
-
end
|
92
|
+
# @deprecated Will be removed in 2.0.0
|
93
|
+
def setup!
|
94
|
+
warn "Sidekiq::Throttled.setup! was deprecated"
|
105
95
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
# server restart (becomes normal after all Sidekiq processes handled
|
112
|
-
# at leas onr job of that class).
|
113
|
-
#
|
114
|
-
# @return [void]
|
115
|
-
def preload_constant!(job)
|
116
|
-
MUTEX.synchronize do
|
117
|
-
@preloaded ||= {}
|
118
|
-
@preloaded[job] ||= constantize(job) || true
|
96
|
+
Sidekiq.configure_server do |config|
|
97
|
+
config.server_middleware do |chain|
|
98
|
+
chain.remove(Sidekiq::Throttled::Middlewares::Server)
|
99
|
+
chain.add(Sidekiq::Throttled::Middlewares::Server)
|
100
|
+
end
|
119
101
|
end
|
120
102
|
end
|
121
103
|
end
|
122
104
|
end
|
105
|
+
|
106
|
+
configure_server do |config|
|
107
|
+
config.server_middleware do |chain|
|
108
|
+
chain.add(Sidekiq::Throttled::Middlewares::Server)
|
109
|
+
end
|
110
|
+
end
|
123
111
|
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:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Zapparov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis-prescription
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,72 +40,35 @@ dependencies:
|
|
40
40
|
version: '2.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sidekiq
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '6.4'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '6.4'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
-
type: :
|
47
|
+
version: '6.5'
|
48
|
+
type: :runtime
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
69
|
-
description:
|
54
|
+
version: '6.5'
|
55
|
+
description:
|
70
56
|
email:
|
71
57
|
- alexey@zapparov.com
|
72
58
|
executables: []
|
73
59
|
extensions: []
|
74
60
|
extra_rdoc_files: []
|
75
61
|
files:
|
76
|
-
-
|
77
|
-
-
|
78
|
-
- ".github/workflows/ci.yml"
|
79
|
-
- ".gitignore"
|
80
|
-
- ".rspec"
|
81
|
-
- ".rubocop.yml"
|
82
|
-
- ".rubocop_todo.yml"
|
83
|
-
- ".travis.yml"
|
84
|
-
- ".yardopts"
|
85
|
-
- Appraisals
|
86
|
-
- CHANGES.md
|
87
|
-
- Gemfile
|
88
|
-
- Guardfile
|
89
|
-
- LICENSE.md
|
90
|
-
- README.md
|
91
|
-
- Rakefile
|
92
|
-
- gemfiles/sidekiq_6.4.gemfile
|
93
|
-
- gemfiles/sidekiq_6.5.gemfile
|
62
|
+
- LICENSE.txt
|
63
|
+
- README.adoc
|
94
64
|
- lib/sidekiq/throttled.rb
|
95
|
-
- lib/sidekiq/throttled/
|
96
|
-
- lib/sidekiq/throttled/
|
97
|
-
- lib/sidekiq/throttled/communicator/exception_handler.rb
|
98
|
-
- lib/sidekiq/throttled/communicator/listener.rb
|
99
|
-
- lib/sidekiq/throttled/configuration.rb
|
65
|
+
- lib/sidekiq/throttled/config.rb
|
66
|
+
- lib/sidekiq/throttled/cooldown.rb
|
100
67
|
- lib/sidekiq/throttled/errors.rb
|
101
|
-
- lib/sidekiq/throttled/
|
102
|
-
- lib/sidekiq/throttled/fetch.rb
|
103
|
-
- lib/sidekiq/throttled/fetch/unit_of_work.rb
|
68
|
+
- lib/sidekiq/throttled/expirable_set.rb
|
104
69
|
- lib/sidekiq/throttled/job.rb
|
105
|
-
- lib/sidekiq/throttled/
|
106
|
-
- lib/sidekiq/throttled/patches/
|
107
|
-
- lib/sidekiq/throttled/queue_name.rb
|
108
|
-
- lib/sidekiq/throttled/queues_pauser.rb
|
70
|
+
- lib/sidekiq/throttled/middlewares/server.rb
|
71
|
+
- lib/sidekiq/throttled/patches/basic_fetch.rb
|
109
72
|
- lib/sidekiq/throttled/registry.rb
|
110
73
|
- lib/sidekiq/throttled/strategy.rb
|
111
74
|
- lib/sidekiq/throttled/strategy/base.rb
|
@@ -114,27 +77,19 @@ files:
|
|
114
77
|
- lib/sidekiq/throttled/strategy/threshold.lua
|
115
78
|
- lib/sidekiq/throttled/strategy/threshold.rb
|
116
79
|
- lib/sidekiq/throttled/strategy_collection.rb
|
117
|
-
- lib/sidekiq/throttled/testing.rb
|
118
|
-
- lib/sidekiq/throttled/utils.rb
|
119
80
|
- lib/sidekiq/throttled/version.rb
|
120
81
|
- lib/sidekiq/throttled/web.rb
|
121
|
-
- lib/sidekiq/throttled/web/queues.html.erb
|
122
82
|
- lib/sidekiq/throttled/web/stats.rb
|
123
|
-
- lib/sidekiq/throttled/web/summary_fix.js
|
124
|
-
- lib/sidekiq/throttled/web/summary_fix.rb
|
125
83
|
- lib/sidekiq/throttled/web/throttled.html.erb
|
126
84
|
- lib/sidekiq/throttled/worker.rb
|
127
|
-
- rubocop/layout.yml
|
128
|
-
- rubocop/lint.yml
|
129
|
-
- rubocop/metrics.yml
|
130
|
-
- rubocop/performance.yml
|
131
|
-
- rubocop/rspec.yml
|
132
|
-
- rubocop/style.yml
|
133
|
-
- sidekiq-throttled.gemspec
|
134
85
|
homepage: https://github.com/ixti/sidekiq-throttled
|
135
86
|
licenses:
|
136
87
|
- MIT
|
137
88
|
metadata:
|
89
|
+
homepage_uri: https://github.com/ixti/sidekiq-throttled
|
90
|
+
source_code_uri: https://github.com/ixti/sidekiq-throttled/tree/v1.1.0
|
91
|
+
bug_tracker_uri: https://github.com/ixti/sidekiq-throttled/issues
|
92
|
+
changelog_uri: https://github.com/ixti/sidekiq-throttled/blob/v1.1.0/CHANGES.md
|
138
93
|
rubygems_mfa_required: 'true'
|
139
94
|
post_install_message:
|
140
95
|
rdoc_options: []
|
@@ -144,15 +99,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
99
|
requirements:
|
145
100
|
- - ">="
|
146
101
|
- !ruby/object:Gem::Version
|
147
|
-
version: '
|
102
|
+
version: '3.0'
|
148
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
104
|
requirements:
|
150
105
|
- - ">="
|
151
106
|
- !ruby/object:Gem::Version
|
152
107
|
version: '0'
|
153
108
|
requirements: []
|
154
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.4.10
|
155
110
|
signing_key:
|
156
111
|
specification_version: 4
|
157
|
-
summary: Concurrency and
|
112
|
+
summary: Concurrency and rate-limit throttling for Sidekiq
|
158
113
|
test_files: []
|
data/.coveralls.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
service_name: travis-ci
|
data/.github/dependabot.yml
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
2
|
-
|
3
|
-
version: 2
|
4
|
-
updates:
|
5
|
-
- package-ecosystem: "github-actions"
|
6
|
-
directory: "/"
|
7
|
-
schedule:
|
8
|
-
interval: "daily"
|
9
|
-
- package-ecosystem: "bundler"
|
10
|
-
directory: "/"
|
11
|
-
schedule:
|
12
|
-
interval: "daily"
|
data/.github/workflows/ci.yml
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
name: CI
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ main ]
|
6
|
-
pull_request:
|
7
|
-
branches: [ main ]
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
test:
|
11
|
-
name: "rspec (ruby:${{ matrix.ruby }} sidekiq:${{ matrix.sidekiq }})"
|
12
|
-
|
13
|
-
strategy:
|
14
|
-
fail-fast: false
|
15
|
-
matrix:
|
16
|
-
ruby: [ "2.7", "3.0", "3.1" ]
|
17
|
-
sidekiq: [ "6.4", "6.5" ]
|
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
|
-
BUNDLE_GEMFILE: gemfiles/sidekiq_${{ matrix.sidekiq }}.gemfile
|
29
|
-
|
30
|
-
steps:
|
31
|
-
- uses: actions/checkout@v3
|
32
|
-
|
33
|
-
- uses: ruby/setup-ruby@v1
|
34
|
-
with:
|
35
|
-
ruby-version: ${{ matrix.ruby }}
|
36
|
-
bundler-cache: true
|
37
|
-
|
38
|
-
- name: bundle exec rspec
|
39
|
-
run: bundle exec rspec --format progress --force-colour
|
40
|
-
|
41
|
-
rubocop:
|
42
|
-
runs-on: ubuntu-latest
|
43
|
-
|
44
|
-
steps:
|
45
|
-
- uses: actions/checkout@v3
|
46
|
-
|
47
|
-
- uses: ruby/setup-ruby@v1
|
48
|
-
with:
|
49
|
-
ruby-version: "2.7"
|
50
|
-
bundler-cache: true
|
51
|
-
|
52
|
-
- run: bundle exec rubocop
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-performance
|
3
|
-
- rubocop-rake
|
4
|
-
- rubocop-rspec
|
5
|
-
|
6
|
-
inherit_from:
|
7
|
-
- .rubocop_todo.yml
|
8
|
-
- rubocop/layout.yml
|
9
|
-
- rubocop/lint.yml
|
10
|
-
- rubocop/metrics.yml
|
11
|
-
- rubocop/performance.yml
|
12
|
-
- rubocop/rspec.yml
|
13
|
-
- rubocop/style.yml
|
14
|
-
|
15
|
-
AllCops:
|
16
|
-
Exclude:
|
17
|
-
- gemfiles/**/*
|
18
|
-
- vendor/**/*
|
19
|
-
NewCops: enable
|
20
|
-
TargetRubyVersion: 2.7
|
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
|