sidekiq-pool 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 822b46902627b61973c1905dfed9223cfe254c11
4
- data.tar.gz: 2896e3ca6cc155ffee742772774277ff3153de61
3
+ metadata.gz: a5974ee249b01b0fb3a17c162fede983844a9d00
4
+ data.tar.gz: 4cde7515556b589535e6e2c1b75e684af65a1066
5
5
  SHA512:
6
- metadata.gz: fb195a68d655ac395ff0b0779056b1cae681ee571286e10155dcd41ee85b433854a4677732ad3625147fc5c29d0fd3a51aeb9cb45b159e3d3b9dd21b9bc9f082
7
- data.tar.gz: 7c28bc892c1b7aceb7207810091ce8725190889790ad3ce3812aa357416dbaa6f46968e2b8f653ad164171b5ea1ed114dec487a7c867293a7abebda565300858
6
+ metadata.gz: 531cb2f5f5441385f62fcefff96f7cc18ae7983f3c26d6cabaf4bb007afe3559b7f4045d244ad2d61d99ca196c61c0c7be320d95fcaabc29876edd1afeb990ef
7
+ data.tar.gz: 3559bfeb53c632f4ad257a9256ca9779bc644df993711ee6db65d3a8371d35874e9ab0056bfceb4e8b2248b7a6ff8e320fb23d375a0dcb99d43c82d222c74f61
@@ -50,7 +50,7 @@ module Sidekiq
50
50
  @types.each do |type|
51
51
  type[:amount].times do
52
52
  sleep @fork_wait || DEFAULT_FORK_WAIT
53
- add_child(type[:command])
53
+ fork_child(type[:command])
54
54
  end
55
55
  end
56
56
  end
@@ -166,7 +166,8 @@ module Sidekiq
166
166
  end
167
167
  end
168
168
 
169
- def fork_child(command)
169
+ def fork_child(command, wait_for_busy = true)
170
+ logger.info "Adding child with args: (#{command}), waiting for busy: #{wait_for_busy}"
170
171
  pid = fork do
171
172
  opts = parse_options(command.split)
172
173
  options.merge!(opts)
@@ -183,7 +184,7 @@ module Sidekiq
183
184
  break if (wait_until_child_loaded -= 1).zero?
184
185
  logger.info "Waiting for child #{pid} to be busy break in #{wait_until_child_loaded}"
185
186
  sleep 1
186
- end
187
+ end if wait_for_busy
187
188
 
188
189
  @pool << { pid: pid, command: command }
189
190
  end
@@ -230,11 +231,6 @@ module Sidekiq
230
231
  end
231
232
  end
232
233
 
233
- def add_child(*arg)
234
- logger.info "Adding child with args: #{arg}"
235
- fork_child(*arg)
236
- end
237
-
238
234
  def signal_to_pool(sig, given_pool = @pool)
239
235
  given_pool.each { |child| signal_to_child(sig, child[:pid]) }
240
236
  end
@@ -256,7 +252,7 @@ module Sidekiq
256
252
  def handle_dead_child(child)
257
253
  logger.info "Child #{child[:pid]} died"
258
254
  @pool.delete(child)
259
- add_child(child[:command])
255
+ fork_child(child[:command], false)
260
256
  end
261
257
 
262
258
  def alive?(pid)
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Pool
3
- VERSION = '1.4.0'
3
+ VERSION = '1.5.0'
4
4
  end
5
5
  end
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.0
4
+ version: 1.5.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-10 00:00:00.000000000 Z
11
+ date: 2017-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq