sidekiq-pool 1.8.1 → 1.9.2
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 +15 -9
- data/lib/sidekiq/pool/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ec19ae3f1256d1c291c33af8c7e95ab8aa2139b519035947ce7206b5e1af32c
|
4
|
+
data.tar.gz: 8a7f862dcb0729c9ea68c87a33307a167e62475915e5ffc8f688f367258dcd9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac9432289be3890128ed433dbff50f3df482418d966e8af02ad99045554745f4b71504b03985772e2ea8afbb283b193fd9553c2c8056a8aa1fff44a2ff2586cd
|
7
|
+
data.tar.gz: cf1ffe878314497d4559561dba70bfe282e128b78a5ef7aa4ae61e2a101cba693b9041fa6429a929845ca35d8abdcbb20b6c18f3cc59ade5af61af77015299dc
|
data/lib/sidekiq/pool/cli.rb
CHANGED
@@ -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
|
@@ -20,8 +19,13 @@ module Sidekiq
|
|
20
19
|
|
21
20
|
alias_method :run_child, :run
|
22
21
|
|
22
|
+
def write_pid
|
23
|
+
super if @master_pid == ::Process.pid
|
24
|
+
end
|
25
|
+
|
23
26
|
def run
|
24
27
|
@master_pid = $$
|
28
|
+
write_pid
|
25
29
|
|
26
30
|
trap_signals
|
27
31
|
update_process_name
|
@@ -69,10 +73,12 @@ module Sidekiq
|
|
69
73
|
boot_system
|
70
74
|
|
71
75
|
@types = @settings[:workers]
|
76
|
+
index = -1
|
72
77
|
@types.each do |type|
|
73
78
|
type[:amount].times do
|
79
|
+
index += 1
|
74
80
|
sleep @fork_wait || DEFAULT_FORK_WAIT
|
75
|
-
fork_child(type[:command])
|
81
|
+
fork_child(type[:command], index)
|
76
82
|
end
|
77
83
|
end
|
78
84
|
drop_reload_marker
|
@@ -189,7 +195,7 @@ module Sidekiq
|
|
189
195
|
end
|
190
196
|
end
|
191
197
|
|
192
|
-
def fork_child(command, wait_for_busy = true)
|
198
|
+
def fork_child(command, index, wait_for_busy = true)
|
193
199
|
logger.info "Adding child with args: (#{command}) in #{working_directory}, waiting for busy: #{wait_for_busy}"
|
194
200
|
if working_directory && !Dir.exist?(working_directory)
|
195
201
|
logger.info "Working directory: #{working_directory} does not exist unable to fork"
|
@@ -202,14 +208,14 @@ module Sidekiq
|
|
202
208
|
options.merge!(opts)
|
203
209
|
|
204
210
|
@self_write.close
|
205
|
-
$0 =
|
206
|
-
|
207
|
-
options[:index] = @child_index
|
211
|
+
$0 = "sidekiq #{Sidekiq::VERSION} worker #{index} starting"
|
212
|
+
options[:index] = index
|
208
213
|
|
209
214
|
# reset child identity
|
210
215
|
@@process_nonce = nil
|
211
216
|
@@identity = nil
|
212
217
|
options[:identity] = identity
|
218
|
+
options[:tag] = "worker #{index}"
|
213
219
|
|
214
220
|
run_after_fork_hooks
|
215
221
|
run_child
|
@@ -223,7 +229,7 @@ module Sidekiq
|
|
223
229
|
sleep 1
|
224
230
|
end if wait_for_busy
|
225
231
|
|
226
|
-
@pool << { pid: pid, command: command }
|
232
|
+
@pool << { pid: pid, index: index, command: command }
|
227
233
|
end
|
228
234
|
|
229
235
|
def wait_for_signals
|
@@ -309,9 +315,9 @@ module Sidekiq
|
|
309
315
|
end
|
310
316
|
|
311
317
|
def handle_dead_child(child)
|
312
|
-
logger.info "Child #{child[:pid]} died"
|
318
|
+
logger.info "Child #{child[:pid]} (worker #{child[:index]}) died"
|
313
319
|
@pool.delete(child)
|
314
|
-
fork_child(child[:command], false)
|
320
|
+
fork_child(child[:command], child[:index], false)
|
315
321
|
end
|
316
322
|
|
317
323
|
def alive?(pid)
|
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.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vinted
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|