sidekiq-throttled 0.9.0 → 0.10.0.alpha
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/CHANGES.md +1 -1
- data/lib/sidekiq/throttled/queues_pauser.rb +42 -11
- data/lib/sidekiq/throttled/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83591901b017e382b25575720fab1bbcc45ac9e81acec417da1a10cbfa333613
|
4
|
+
data.tar.gz: 1a135a2b18d51b644f7713cdd1d2bcad6ffe34b87ca93b11aa1336e2e1b91a8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 594b29b269f4b8c2351adf7f835cad04d974794ef596fdcd5492202c4e4f6af5d1a06b7ec67baf15a6d393aa2a60093cc7a536f87c8260f3681b25a817d94990
|
7
|
+
data.tar.gz: d4e9d76b8627c86ee7e399e563d7c9ce8bdbabc40444349a88ce88ea3bec136974505feb9b49d905bf47fc9aaf233270e9637ebca027d533e589ca93cc6cb2f5
|
data/CHANGES.md
CHANGED
@@ -39,6 +39,7 @@ module Sidekiq
|
|
39
39
|
def initialize
|
40
40
|
@paused_queues = Set.new
|
41
41
|
@communicator = Communicator.instance
|
42
|
+
@mutex = Mutex.new
|
42
43
|
end
|
43
44
|
|
44
45
|
# Configures Sidekiq server to keep actual list of paused queues.
|
@@ -48,18 +49,13 @@ module Sidekiq
|
|
48
49
|
def setup!
|
49
50
|
Patches::Queue.apply!
|
50
51
|
|
51
|
-
Sidekiq.configure_server do
|
52
|
-
|
53
|
-
|
54
|
-
end
|
52
|
+
Sidekiq.configure_server do |config|
|
53
|
+
config.on(:startup) { start_watcher }
|
54
|
+
config.on(:quiet) { stop_watcher }
|
55
55
|
|
56
|
-
@communicator.receive
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
@communicator.ready do
|
61
|
-
@paused_queues.replace(paused_queues.map { |q| QueueName.expand q })
|
62
|
-
end
|
56
|
+
@communicator.receive(PAUSE_MESSAGE, &method(:add))
|
57
|
+
@communicator.receive(RESUME_MESSAGE, &method(:delete))
|
58
|
+
@communicator.ready(&method(:sync!))
|
63
59
|
end
|
64
60
|
end
|
65
61
|
|
@@ -112,6 +108,41 @@ module Sidekiq
|
|
112
108
|
@communicator.transmit(conn, RESUME_MESSAGE, queue)
|
113
109
|
end
|
114
110
|
end
|
111
|
+
|
112
|
+
private
|
113
|
+
|
114
|
+
def add(queue)
|
115
|
+
@mutex.synchronize do
|
116
|
+
@paused_queues << QueueName.expand(queue)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def delete(queue)
|
121
|
+
@mutex.synchronize do
|
122
|
+
@paused_queues.delete QueueName.expand(queue)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def sync!
|
127
|
+
@mutex.synchronize do
|
128
|
+
@paused_queues.replace(paused_queues.map { |q| QueueName.expand q })
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def start_watcher
|
133
|
+
@mutex.synchronize do
|
134
|
+
@watcher ||= Concurrent::TimerTask.execute({
|
135
|
+
:run_now => true,
|
136
|
+
:execution_interval => 60
|
137
|
+
}) { sync! }
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def stop_watcher
|
142
|
+
@mutex.synchronize do
|
143
|
+
defined?(@watcher) && @watcher&.shutdown
|
144
|
+
end
|
145
|
+
end
|
115
146
|
end
|
116
147
|
end
|
117
148
|
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: 0.
|
4
|
+
version: 0.10.0.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey V Zapparov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -134,9 +134,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - "
|
137
|
+
- - ">"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
139
|
+
version: 1.3.1
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
142
|
rubygems_version: 2.7.6
|