mirror of
https://github.com/ditkrg/rabbit_carrots.git
synced 2026-01-22 13:56:41 +00:00
Refactors process ID handling in Rabbit Carrots plugin and enhances logging for shutdown scenarios
This commit is contained in:
parent
f68ab83afc
commit
aee5a1e3cb
@ -8,7 +8,7 @@ Puma::Plugin.create do
|
||||
|
||||
def start(launcher)
|
||||
@log_writer = launcher.log_writer
|
||||
@puma_pid = $$
|
||||
@puma_pid = $PROCESS_ID
|
||||
|
||||
@core_service = RabbitCarrots::Core.new(logger: log_writer)
|
||||
|
||||
@ -43,6 +43,7 @@ Puma::Plugin.create do
|
||||
Process.kill('TERM', rabbit_carrots_pid)
|
||||
Process.wait(rabbit_carrots_pid)
|
||||
rescue Errno::ECHILD, Errno::ESRCH
|
||||
log 'Rabbit Carrots already stopped'
|
||||
end
|
||||
|
||||
def monitor_puma
|
||||
@ -57,7 +58,7 @@ Puma::Plugin.create do
|
||||
loop do
|
||||
if send(process_dead)
|
||||
log message
|
||||
Process.kill('TERM', $$)
|
||||
Process.kill('TERM', $PROCESS_ID)
|
||||
break
|
||||
end
|
||||
sleep 2
|
||||
|
||||
@ -18,8 +18,8 @@ module RabbitCarrots
|
||||
:rabbitmq_exchange_name,
|
||||
:automatically_recover,
|
||||
:network_recovery_interval,
|
||||
:recovery_attempts,
|
||||
:orm
|
||||
:recovery_attempts
|
||||
|
||||
def orm
|
||||
@orm ||= :activerecord
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user