sidekiq-limit_fetch 4.3.2 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/Appraisals +4 -0
- data/README.md +11 -1
- data/docker-compose.dev.yml +13 -0
- data/gemfiles/sidekiq_6.0.gemfile.lock +3 -4
- data/gemfiles/sidekiq_6.1.gemfile.lock +3 -4
- data/gemfiles/sidekiq_6.2.gemfile.lock +3 -4
- data/gemfiles/sidekiq_6.3.gemfile.lock +3 -4
- data/gemfiles/sidekiq_6.4.gemfile.lock +3 -4
- data/gemfiles/sidekiq_6.5.gemfile.lock +3 -4
- data/gemfiles/sidekiq_7.0.gemfile +7 -0
- data/gemfiles/sidekiq_7.0.gemfile.lock +58 -0
- data/gemfiles/sidekiq_master.gemfile.lock +3 -4
- data/lib/sidekiq/extensions/manager.rb +6 -1
- data/lib/sidekiq/limit_fetch/global/monitor.rb +8 -3
- data/lib/sidekiq/limit_fetch/global/selector.rb +9 -5
- data/lib/sidekiq/limit_fetch/global/semaphore.rb +5 -5
- data/lib/sidekiq/limit_fetch/queues.rb +16 -1
- data/lib/sidekiq/limit_fetch.rb +18 -3
- data/sidekiq-limit_fetch.gemspec +3 -4
- data/spec/sidekiq/limit_fetch/global/monitor_spec.rb +56 -2
- data/spec/spec_helper.rb +8 -2
- metadata +7 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60f78289f95ff030e04baa2f82f05adb60e40a022ca338f06a3c7bffcd69a348
|
4
|
+
data.tar.gz: 237c99bbf64fc49dcb85452bfcbca459ef4745b467455a34c8662e1f523a0663
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbc1b8489daab83e229590f24a5bd3213804e7fd51b9bb74c1c299812c551e0df06145ae03f9c5f60c993209cd294864d3b044d2b30c27ec138b4ba20fab546c
|
7
|
+
data.tar.gz: 54c0ba14c23a84e8167855c0c759bdb9df315af8aa090bca2d59e930bbfa22011520e7788990c27a5aacb6661b61db7a6a6abdf30afec4de6a5a38fffff60a04
|
data/.github/workflows/ci.yml
CHANGED
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## Description
|
2
2
|
|
3
|
-
*This project has been taken over by [@deanpcmad](https://github.com/deanpcmad)
|
3
|
+
*This project has been taken over by [@deanpcmad](https://github.com/deanpcmad). Original code by [@brainopia](https://github.com/brainopia).*
|
4
4
|
|
5
5
|
Sidekiq strategy to support a granular queue control – limiting, pausing, blocking, querying.
|
6
6
|
|
@@ -150,6 +150,16 @@ To use this mode you need to specify a following line in sidekiq.yml:
|
|
150
150
|
:dynamic: true
|
151
151
|
```
|
152
152
|
|
153
|
+
or
|
154
|
+
|
155
|
+
```yaml
|
156
|
+
:dynamic:
|
157
|
+
:exclude:
|
158
|
+
- excluded_queue
|
159
|
+
```
|
160
|
+
|
161
|
+
to exclude `excluded_queue` from dynamic queue
|
162
|
+
|
153
163
|
Dynamic queues will be ran at the lowest priority.
|
154
164
|
|
155
165
|
### Maintenance
|
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
sidekiq-limit_fetch (4.
|
5
|
-
|
6
|
-
sidekiq (>= 4)
|
4
|
+
sidekiq-limit_fetch (4.4.0)
|
5
|
+
sidekiq (>= 6)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -53,4 +52,4 @@ DEPENDENCIES
|
|
53
52
|
sidekiq-limit_fetch!
|
54
53
|
|
55
54
|
BUNDLED WITH
|
56
|
-
2.3.
|
55
|
+
2.3.5
|
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
sidekiq-limit_fetch (4.
|
5
|
-
|
6
|
-
sidekiq (>= 4)
|
4
|
+
sidekiq-limit_fetch (4.4.0)
|
5
|
+
sidekiq (>= 6)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -50,4 +49,4 @@ DEPENDENCIES
|
|
50
49
|
sidekiq-limit_fetch!
|
51
50
|
|
52
51
|
BUNDLED WITH
|
53
|
-
2.3.
|
52
|
+
2.3.5
|
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
sidekiq-limit_fetch (4.
|
5
|
-
|
6
|
-
sidekiq (>= 4)
|
4
|
+
sidekiq-limit_fetch (4.4.0)
|
5
|
+
sidekiq (>= 6)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -50,4 +49,4 @@ DEPENDENCIES
|
|
50
49
|
sidekiq-limit_fetch!
|
51
50
|
|
52
51
|
BUNDLED WITH
|
53
|
-
2.3.
|
52
|
+
2.3.5
|
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
sidekiq-limit_fetch (4.
|
5
|
-
|
6
|
-
sidekiq (>= 4)
|
4
|
+
sidekiq-limit_fetch (4.4.0)
|
5
|
+
sidekiq (>= 6)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -50,4 +49,4 @@ DEPENDENCIES
|
|
50
49
|
sidekiq-limit_fetch!
|
51
50
|
|
52
51
|
BUNDLED WITH
|
53
|
-
2.3.
|
52
|
+
2.3.5
|
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
sidekiq-limit_fetch (4.
|
5
|
-
|
6
|
-
sidekiq (>= 4)
|
4
|
+
sidekiq-limit_fetch (4.4.0)
|
5
|
+
sidekiq (>= 6)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -50,4 +49,4 @@ DEPENDENCIES
|
|
50
49
|
sidekiq-limit_fetch!
|
51
50
|
|
52
51
|
BUNDLED WITH
|
53
|
-
2.3.
|
52
|
+
2.3.5
|
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
sidekiq-limit_fetch (4.
|
5
|
-
|
6
|
-
sidekiq (>= 4)
|
4
|
+
sidekiq-limit_fetch (4.4.0)
|
5
|
+
sidekiq (>= 6)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -50,4 +49,4 @@ DEPENDENCIES
|
|
50
49
|
sidekiq-limit_fetch!
|
51
50
|
|
52
51
|
BUNDLED WITH
|
53
|
-
2.3.
|
52
|
+
2.3.5
|
@@ -0,0 +1,58 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
sidekiq-limit_fetch (4.4.0)
|
5
|
+
sidekiq (>= 6)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
appraisal (2.4.1)
|
11
|
+
bundler
|
12
|
+
rake
|
13
|
+
thor (>= 0.14.0)
|
14
|
+
concurrent-ruby (1.1.10)
|
15
|
+
connection_pool (2.3.0)
|
16
|
+
diff-lcs (1.5.0)
|
17
|
+
rack (3.0.2)
|
18
|
+
rake (13.0.6)
|
19
|
+
redis (5.0.5)
|
20
|
+
redis-client (>= 0.9.0)
|
21
|
+
redis-client (0.11.2)
|
22
|
+
connection_pool
|
23
|
+
redis-namespace (1.10.0)
|
24
|
+
redis (>= 4)
|
25
|
+
rspec (3.12.0)
|
26
|
+
rspec-core (~> 3.12.0)
|
27
|
+
rspec-expectations (~> 3.12.0)
|
28
|
+
rspec-mocks (~> 3.12.0)
|
29
|
+
rspec-core (3.12.0)
|
30
|
+
rspec-support (~> 3.12.0)
|
31
|
+
rspec-expectations (3.12.1)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.12.0)
|
34
|
+
rspec-mocks (3.12.1)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.12.0)
|
37
|
+
rspec-support (3.12.0)
|
38
|
+
sidekiq (7.0.2)
|
39
|
+
concurrent-ruby (< 2)
|
40
|
+
connection_pool (>= 2.3.0)
|
41
|
+
rack (>= 2.2.4)
|
42
|
+
redis-client (>= 0.11.0)
|
43
|
+
thor (1.2.1)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
x86_64-darwin-21
|
47
|
+
x86_64-linux
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
appraisal
|
51
|
+
rake
|
52
|
+
redis-namespace (~> 1.5, >= 1.5.2)
|
53
|
+
rspec
|
54
|
+
sidekiq (~> 7.0.0)
|
55
|
+
sidekiq-limit_fetch!
|
56
|
+
|
57
|
+
BUNDLED WITH
|
58
|
+
2.3.5
|
@@ -10,9 +10,8 @@ GIT
|
|
10
10
|
PATH
|
11
11
|
remote: ..
|
12
12
|
specs:
|
13
|
-
sidekiq-limit_fetch (4.
|
14
|
-
|
15
|
-
sidekiq (>= 4)
|
13
|
+
sidekiq-limit_fetch (4.4.0)
|
14
|
+
sidekiq (>= 6)
|
16
15
|
|
17
16
|
GEM
|
18
17
|
remote: https://rubygems.org/
|
@@ -55,4 +54,4 @@ DEPENDENCIES
|
|
55
54
|
sidekiq-limit_fetch!
|
56
55
|
|
57
56
|
BUNDLED WITH
|
58
|
-
2.3.
|
57
|
+
2.3.5
|
@@ -1,7 +1,12 @@
|
|
1
1
|
class Sidekiq::Manager
|
2
2
|
module InitLimitFetch
|
3
3
|
def initialize(options={})
|
4
|
-
|
4
|
+
if Sidekiq::LimitFetch.post_7?
|
5
|
+
options.config[:fetch] = Sidekiq::LimitFetch
|
6
|
+
else
|
7
|
+
options[:fetch] = Sidekiq::LimitFetch
|
8
|
+
end
|
9
|
+
|
5
10
|
super
|
6
11
|
end
|
7
12
|
|
@@ -27,7 +27,7 @@ module Sidekiq::LimitFetch::Global
|
|
27
27
|
|
28
28
|
def old_processes
|
29
29
|
all_processes.reject do |process|
|
30
|
-
Sidekiq.redis {|it| it.get heartbeat_key process }
|
30
|
+
Sidekiq.redis {|it| it.get heartbeat_key process } == '1'
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -39,7 +39,12 @@ module Sidekiq::LimitFetch::Global
|
|
39
39
|
|
40
40
|
def handle_dynamic_queues
|
41
41
|
queues = Sidekiq::LimitFetch::Queues
|
42
|
-
|
42
|
+
return unless queues.dynamic?
|
43
|
+
|
44
|
+
available_queues = Sidekiq::Queue.all.map(&:name).reject do |it|
|
45
|
+
queues.dynamic_exclude.include? it
|
46
|
+
end
|
47
|
+
queues.handle available_queues
|
43
48
|
end
|
44
49
|
|
45
50
|
private
|
@@ -47,7 +52,7 @@ module Sidekiq::LimitFetch::Global
|
|
47
52
|
def update_heartbeat(ttl)
|
48
53
|
Sidekiq.redis do |it|
|
49
54
|
it.multi do |pipeline|
|
50
|
-
pipeline.set heartbeat_key,
|
55
|
+
pipeline.set heartbeat_key, '1'
|
51
56
|
pipeline.sadd PROCESS_SET, [Selector.uuid]
|
52
57
|
pipeline.expire heartbeat_key, ttl
|
53
58
|
end
|
@@ -25,20 +25,24 @@ module Sidekiq::LimitFetch::Global
|
|
25
25
|
def redis_eval(script_name, args)
|
26
26
|
Sidekiq.redis do |it|
|
27
27
|
begin
|
28
|
-
it.evalsha send("redis_#{script_name}_sha"),
|
29
|
-
rescue
|
28
|
+
it.evalsha send("redis_#{script_name}_sha"), [], args
|
29
|
+
rescue Sidekiq::LimitFetch::RedisCommandError => error
|
30
30
|
raise unless error.message.include? 'NOSCRIPT'
|
31
|
-
|
31
|
+
if Sidekiq::LimitFetch.post_7?
|
32
|
+
it.eval send("redis_#{script_name}_script"), 0, *args
|
33
|
+
else
|
34
|
+
it.eval send("redis_#{script_name}_script"), argv: args
|
35
|
+
end
|
32
36
|
end
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
36
40
|
def redis_acquire_sha
|
37
|
-
@acquire_sha ||= Digest::SHA1.hexdigest redis_acquire_script
|
41
|
+
@acquire_sha ||= OpenSSL::Digest::SHA1.hexdigest redis_acquire_script
|
38
42
|
end
|
39
43
|
|
40
44
|
def redis_release_sha
|
41
|
-
@release_sha ||= Digest::SHA1.hexdigest redis_release_script
|
45
|
+
@release_sha ||= OpenSSL::Digest::SHA1.hexdigest redis_release_script
|
42
46
|
end
|
43
47
|
|
44
48
|
def redis_acquire_script
|
@@ -77,11 +77,11 @@ module Sidekiq::LimitFetch::Global
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def pause
|
80
|
-
redis {|it| it.set "#{PREFIX}:pause:#@name",
|
80
|
+
redis {|it| it.set "#{PREFIX}:pause:#@name", '1' }
|
81
81
|
end
|
82
82
|
|
83
83
|
def pause_for_ms ms
|
84
|
-
redis {|it| it.psetex "#{PREFIX}:pause:#@name", ms,
|
84
|
+
redis {|it| it.psetex "#{PREFIX}:pause:#@name", ms, 1 }
|
85
85
|
end
|
86
86
|
|
87
87
|
def unpause
|
@@ -89,11 +89,11 @@ module Sidekiq::LimitFetch::Global
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def paused?
|
92
|
-
redis {|it| it.get "#{PREFIX}:pause:#@name" }
|
92
|
+
redis {|it| it.get "#{PREFIX}:pause:#@name" } == '1'
|
93
93
|
end
|
94
94
|
|
95
95
|
def block
|
96
|
-
redis {|it| it.set "#{PREFIX}:block:#@name",
|
96
|
+
redis {|it| it.set "#{PREFIX}:block:#@name", '1' }
|
97
97
|
end
|
98
98
|
|
99
99
|
def block_except(*queues)
|
@@ -106,7 +106,7 @@ module Sidekiq::LimitFetch::Global
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def blocking?
|
109
|
-
redis {|it| it.get "#{PREFIX}:block:#@name" }
|
109
|
+
redis {|it| it.get "#{PREFIX}:block:#@name" } == '1'
|
110
110
|
end
|
111
111
|
|
112
112
|
def clear_limits
|
@@ -4,9 +4,20 @@ module Sidekiq::LimitFetch::Queues
|
|
4
4
|
THREAD_KEY = :acquired_queues
|
5
5
|
|
6
6
|
def start(options)
|
7
|
+
if Sidekiq::LimitFetch.post_7?
|
8
|
+
options = options.config
|
9
|
+
end
|
10
|
+
|
7
11
|
@queues = options[:queues]
|
8
12
|
@startup_queues = options[:queues].dup
|
9
|
-
|
13
|
+
|
14
|
+
if options[:dynamic].is_a? Hash
|
15
|
+
@dynamic = true
|
16
|
+
@dynamic_exclude = options[:dynamic][:exclude] || []
|
17
|
+
else
|
18
|
+
@dynamic = options[:dynamic]
|
19
|
+
@dynamic_exclude = []
|
20
|
+
end
|
10
21
|
|
11
22
|
@limits = options[:limits] || {}
|
12
23
|
@process_limits = options[:process_limits] || {}
|
@@ -44,6 +55,10 @@ module Sidekiq::LimitFetch::Queues
|
|
44
55
|
@startup_queues.include?(queue)
|
45
56
|
end
|
46
57
|
|
58
|
+
def dynamic_exclude
|
59
|
+
@dynamic_exclude
|
60
|
+
end
|
61
|
+
|
47
62
|
def add(queues)
|
48
63
|
return unless queues
|
49
64
|
queues.each do |queue|
|
data/lib/sidekiq/limit_fetch.rb
CHANGED
@@ -18,6 +18,13 @@ module Sidekiq::LimitFetch
|
|
18
18
|
|
19
19
|
extend self
|
20
20
|
|
21
|
+
def post_7?
|
22
|
+
@post_7 ||= Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('7.0.0')
|
23
|
+
end
|
24
|
+
|
25
|
+
RedisBaseConnectionError = post_7? ? RedisClient::ConnectionError : Redis::BaseConnectionError
|
26
|
+
RedisCommandError = post_7? ? RedisClient::CommandError : Redis::CommandError
|
27
|
+
|
21
28
|
def new(_)
|
22
29
|
self
|
23
30
|
end
|
@@ -45,10 +52,10 @@ module Sidekiq::LimitFetch
|
|
45
52
|
|
46
53
|
def redis_retryable
|
47
54
|
yield
|
48
|
-
rescue
|
55
|
+
rescue RedisBaseConnectionError
|
49
56
|
sleep TIMEOUT
|
50
57
|
retry
|
51
|
-
rescue
|
58
|
+
rescue RedisCommandError => error
|
52
59
|
# If Redis was restarted and is still loading its snapshot,
|
53
60
|
# then we should treat this as a temporary connection error too.
|
54
61
|
if error.message =~ /^LOADING/
|
@@ -70,7 +77,15 @@ module Sidekiq::LimitFetch
|
|
70
77
|
sleep TIMEOUT # there are no queues to handle, so lets sleep
|
71
78
|
[] # and return nothing
|
72
79
|
else
|
73
|
-
redis_retryable
|
80
|
+
redis_retryable do
|
81
|
+
Sidekiq.redis do |it|
|
82
|
+
if post_7?
|
83
|
+
it.blocking_call(false, "brpop", *queues, TIMEOUT)
|
84
|
+
else
|
85
|
+
it.brpop(*queues, timeout: TIMEOUT)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
74
89
|
end
|
75
90
|
end
|
76
91
|
end
|
data/sidekiq-limit_fetch.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'sidekiq-limit_fetch'
|
3
|
-
gem.version = '4.
|
3
|
+
gem.version = '4.4.0'
|
4
4
|
gem.license = 'MIT'
|
5
|
-
gem.authors = ['Dean Perry'
|
5
|
+
gem.authors = ['Dean Perry']
|
6
6
|
gem.email = 'dean@deanpcmad.com'
|
7
7
|
gem.summary = 'Sidekiq strategy to support queue limits'
|
8
8
|
gem.homepage = 'https://github.com/deanpcmad/sidekiq-limit_fetch'
|
@@ -16,8 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.test_files = gem.files.grep %r{^spec/}
|
17
17
|
gem.require_paths = %w(lib)
|
18
18
|
|
19
|
-
gem.add_dependency 'sidekiq', '>=
|
20
|
-
gem.add_dependency 'redis', '>= 4.6.0'
|
19
|
+
gem.add_dependency 'sidekiq', '>= 6'
|
21
20
|
gem.add_development_dependency 'redis-namespace', '~> 1.5', '>= 1.5.2'
|
22
21
|
gem.add_development_dependency 'appraisal'
|
23
22
|
gem.add_development_dependency 'rspec'
|
@@ -3,12 +3,12 @@ RSpec.describe Sidekiq::LimitFetch::Global::Monitor do
|
|
3
3
|
let(:ttl) { 1 }
|
4
4
|
let(:queue) { Sidekiq::Queue[name] }
|
5
5
|
let(:name) { 'default' }
|
6
|
+
let(:timeout) { 0.5 }
|
6
7
|
|
7
|
-
before { monitor }
|
8
8
|
after { monitor.kill }
|
9
9
|
|
10
10
|
context 'old locks' do
|
11
|
-
|
11
|
+
before { monitor }
|
12
12
|
|
13
13
|
it 'should remove invalidated old locks' do
|
14
14
|
2.times { queue.acquire }
|
@@ -29,5 +29,59 @@ RSpec.describe Sidekiq::LimitFetch::Global::Monitor do
|
|
29
29
|
sleep 2*ttl
|
30
30
|
expect(queue.probed).to eq 0
|
31
31
|
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'dynamic queue' do
|
36
|
+
let(:limits) do
|
37
|
+
{
|
38
|
+
'queue1' => 3,
|
39
|
+
'queue2' => 3,
|
40
|
+
}
|
41
|
+
end
|
42
|
+
let(:queues) { %w[queue1 queue2] }
|
43
|
+
let(:queue) { Sidekiq::LimitFetch::Queues }
|
44
|
+
let(:options) do
|
45
|
+
{
|
46
|
+
limits: limits,
|
47
|
+
queues: queues,
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should add dynamic queue' do
|
52
|
+
queue.start(options.merge({ dynamic: true }))
|
53
|
+
monitor
|
54
|
+
|
55
|
+
expect(queue.instance_variable_get(:@queues)).not_to include('queue3')
|
56
|
+
|
57
|
+
Sidekiq.redis do |it|
|
58
|
+
it.sadd 'queues', 'queue3'
|
59
|
+
end
|
60
|
+
|
61
|
+
sleep 2*ttl
|
62
|
+
expect(queue.instance_variable_get(:@queues)).to include('queue3')
|
63
|
+
|
64
|
+
Sidekiq.redis do |it|
|
65
|
+
it.srem 'queues', 'queue3'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should exclude excluded dynamic queue' do
|
70
|
+
queue.start(options.merge({ dynamic: { exclude: ['queue4'] } }))
|
71
|
+
monitor
|
72
|
+
|
73
|
+
expect(queue.instance_variable_get(:@queues)).not_to include('queue4')
|
74
|
+
|
75
|
+
Sidekiq.redis do |it|
|
76
|
+
it.sadd 'queues', 'queue4'
|
77
|
+
end
|
78
|
+
|
79
|
+
sleep 2*ttl
|
80
|
+
expect(queue.instance_variable_get(:@queues)).not_to include('queue4')
|
81
|
+
|
82
|
+
Sidekiq.redis do |it|
|
83
|
+
it.srem 'queues', 'queue4'
|
84
|
+
end
|
85
|
+
end
|
32
86
|
end
|
33
87
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
require 'sidekiq/limit_fetch'
|
2
2
|
|
3
|
-
Sidekiq.
|
4
|
-
Sidekiq.
|
3
|
+
if Sidekiq::LimitFetch.post_7?
|
4
|
+
Sidekiq.configure_embed do |config|
|
5
|
+
config.logger = nil
|
6
|
+
end
|
7
|
+
else
|
8
|
+
Sidekiq.logger = nil
|
9
|
+
Sidekiq.redis = { namespace: ENV['namespace'] }
|
10
|
+
end
|
5
11
|
|
6
12
|
RSpec.configure do |config|
|
7
13
|
config.order = :random
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-limit_fetch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Perry
|
8
|
-
- brainopia
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2023-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: sidekiq
|
@@ -17,28 +16,14 @@ dependencies:
|
|
17
16
|
requirements:
|
18
17
|
- - ">="
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
19
|
+
version: '6'
|
21
20
|
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - ">="
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: redis
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 4.6.0
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 4.6.0
|
26
|
+
version: '6'
|
42
27
|
- !ruby/object:Gem::Dependency
|
43
28
|
name: redis-namespace
|
44
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,6 +115,7 @@ files:
|
|
130
115
|
- demo/config/boot.rb
|
131
116
|
- demo/config/environment.rb
|
132
117
|
- demo/config/environments/development.rb
|
118
|
+
- docker-compose.dev.yml
|
133
119
|
- gemfiles/sidekiq_6.0.gemfile
|
134
120
|
- gemfiles/sidekiq_6.0.gemfile.lock
|
135
121
|
- gemfiles/sidekiq_6.1.gemfile
|
@@ -142,6 +128,8 @@ files:
|
|
142
128
|
- gemfiles/sidekiq_6.4.gemfile.lock
|
143
129
|
- gemfiles/sidekiq_6.5.gemfile
|
144
130
|
- gemfiles/sidekiq_6.5.gemfile.lock
|
131
|
+
- gemfiles/sidekiq_7.0.gemfile
|
132
|
+
- gemfiles/sidekiq_7.0.gemfile.lock
|
145
133
|
- gemfiles/sidekiq_master.gemfile
|
146
134
|
- gemfiles/sidekiq_master.gemfile.lock
|
147
135
|
- lib/sidekiq-limit_fetch.rb
|