sidekiq-pool 1.9.0 → 1.9.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a570cfb2092036b76f35e89ea276f9eb39b7b68645213257a739ae0e7b1d25d
4
- data.tar.gz: 10c418961feaa04d49c0e8c23faefe55c56a4d06a2ea1cf9b57e48958c0ec46d
3
+ metadata.gz: bf98a1a08f14125a21317d2846177402c75beea40e6204e63889db1bd43320ca
4
+ data.tar.gz: f3d39f372b981c12c312e4cd76fd7788bcdcea1122aa320fa12290195798eaaf
5
5
  SHA512:
6
- metadata.gz: 8f88af075fa30a0ef809ec9874cd04ee8794015152e118146bda044ea303828426a67c577e3b7cb141849676fe81dec2b6a41e04737e79a39d34ff39f68bec50
7
- data.tar.gz: e2384bb4207be796b44d45f3f83dbed467cdbbb2bb90b33abdb14cf870545d7e096a2fad8e615f8dd9b068bf18eae030ae300b291be16ea27f8856089dd07469
6
+ metadata.gz: f23137a068a0e6d9a8736df5104875b88c7ed0e70189ad7753cea33c5c62a3e522be30556745b63b1c8ec2656eea135739b361adc70196ec604b2cc3f2ce7d3f
7
+ data.tar.gz: f82f7f8bed62b0f5e8768c35710eadbb938c21609a0493a050a5227c7b75276e3bd196d123ecbabe2f8bda6976a03c426d2a81171caf6e46194f36bfdc4d223e
@@ -11,7 +11,6 @@ module Sidekiq
11
11
  }
12
12
 
13
13
  def initialize
14
- @child_index = 0
15
14
  @pool = []
16
15
  @done = false
17
16
  @system_booted = false
@@ -74,10 +73,12 @@ module Sidekiq
74
73
  boot_system
75
74
 
76
75
  @types = @settings[:workers]
76
+ index = -1
77
77
  @types.each do |type|
78
78
  type[:amount].times do
79
+ index += 1
79
80
  sleep @fork_wait || DEFAULT_FORK_WAIT
80
- fork_child(type[:command])
81
+ fork_child(type[:command], index)
81
82
  end
82
83
  end
83
84
  drop_reload_marker
@@ -194,7 +195,7 @@ module Sidekiq
194
195
  end
195
196
  end
196
197
 
197
- def fork_child(command, wait_for_busy = true)
198
+ def fork_child(command, index, wait_for_busy = true)
198
199
  logger.info "Adding child with args: (#{command}) in #{working_directory}, waiting for busy: #{wait_for_busy}"
199
200
  if working_directory && !Dir.exist?(working_directory)
200
201
  logger.info "Working directory: #{working_directory} does not exist unable to fork"
@@ -208,13 +209,13 @@ module Sidekiq
208
209
 
209
210
  @self_write.close
210
211
  $0 = 'sidekiq starting'
211
- @child_index += 1
212
- options[:index] = @child_index
212
+ options[:index] = index
213
213
 
214
214
  # reset child identity
215
215
  @@process_nonce = nil
216
216
  @@identity = nil
217
217
  options[:identity] = identity
218
+ options[:tag] = "worker #{index}"
218
219
 
219
220
  run_after_fork_hooks
220
221
  run_child
@@ -228,7 +229,7 @@ module Sidekiq
228
229
  sleep 1
229
230
  end if wait_for_busy
230
231
 
231
- @pool << { pid: pid, command: command }
232
+ @pool << { pid: pid, index: index, command: command }
232
233
  end
233
234
 
234
235
  def wait_for_signals
@@ -314,9 +315,9 @@ module Sidekiq
314
315
  end
315
316
 
316
317
  def handle_dead_child(child)
317
- logger.info "Child #{child[:pid]} died"
318
+ logger.info "Child #{child[:pid]} (worker #{child[:index]}) died"
318
319
  @pool.delete(child)
319
- fork_child(child[:command], false)
320
+ fork_child(child[:command], child[:index], false)
320
321
  end
321
322
 
322
323
  def alive?(pid)
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Pool
3
- VERSION = '1.9.0'
3
+ VERSION = '1.9.1'
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.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinted
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-17 00:00:00.000000000 Z
11
+ date: 2022-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq