sidekiq-pool 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sidekiq/pool/cli.rb +20 -0
- data/lib/sidekiq/pool/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e09b8656dabef56cc9db19da9ab961fae510cf9
|
4
|
+
data.tar.gz: 18eac57149dde145c504ae79efe5c02064e82499
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a16ca326b2961c3e3e1db6f2835f00d65c0009b1778922e1b63b30c2e9921deed52ed8d44a83d3c7879fa44b41b80198c42db38a25860e7bfde239f60148246b
|
7
|
+
data.tar.gz: b075f9b7471a25a389fc8c2ec3adfc31ee57fd80ab9688ecd91cff99cdfce11ff634667482e6cb46a3016302a733085b8b5b58d0c224e95a641d2aa4add7787f
|
data/lib/sidekiq/pool/cli.rb
CHANGED
@@ -120,6 +120,10 @@ module Sidekiq
|
|
120
120
|
@working_directory = arg
|
121
121
|
end
|
122
122
|
|
123
|
+
o.on '--wait-until-child-loaded NUM', "Seconds to wait until forked child is busy" do |arg|
|
124
|
+
@wait_until_child_loaded = Integer(arg)
|
125
|
+
end
|
126
|
+
|
123
127
|
o.on '-V', '--version', "Print version and exit" do |arg|
|
124
128
|
puts "Sidekiq #{Sidekiq::VERSION}"
|
125
129
|
die(0)
|
@@ -168,6 +172,15 @@ module Sidekiq
|
|
168
172
|
options[:index] = @child_index++
|
169
173
|
run_child
|
170
174
|
end
|
175
|
+
|
176
|
+
wait_until_child_loaded ||= (@wait_until_child_loaded || 30)
|
177
|
+
|
178
|
+
until cmdline_busy?(pid)
|
179
|
+
break if (wait_until_child_loaded -= 1).zero?
|
180
|
+
logger.info "Waiting for child #{pid} to be busy break in #{wait_until_child_loaded}"
|
181
|
+
sleep 1
|
182
|
+
end
|
183
|
+
|
171
184
|
@pool << { pid: pid, command: command }
|
172
185
|
end
|
173
186
|
|
@@ -249,6 +262,13 @@ module Sidekiq
|
|
249
262
|
false
|
250
263
|
end
|
251
264
|
|
265
|
+
def cmdline_busy?(pid)
|
266
|
+
return unless alive?(pid)
|
267
|
+
cmdline = File.read("/proc/#{pid}/cmdline")
|
268
|
+
return if cmdline.empty?
|
269
|
+
!cmdline.scan(/busy\]/).empty?
|
270
|
+
end
|
271
|
+
|
252
272
|
def stop_children(given_pool = @pool)
|
253
273
|
@done = true
|
254
274
|
logger.info 'Stopping children'
|
data/lib/sidekiq/pool/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-pool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurynas Butkus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|