mirror of
https://github.com/ditkrg/rabbit_carrots.git
synced 2026-01-22 22:06:40 +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)
|
def start(launcher)
|
||||||
@log_writer = launcher.log_writer
|
@log_writer = launcher.log_writer
|
||||||
@puma_pid = $$
|
@puma_pid = $PROCESS_ID
|
||||||
|
|
||||||
@core_service = RabbitCarrots::Core.new(logger: log_writer)
|
@core_service = RabbitCarrots::Core.new(logger: log_writer)
|
||||||
|
|
||||||
@ -43,6 +43,7 @@ Puma::Plugin.create do
|
|||||||
Process.kill('TERM', rabbit_carrots_pid)
|
Process.kill('TERM', rabbit_carrots_pid)
|
||||||
Process.wait(rabbit_carrots_pid)
|
Process.wait(rabbit_carrots_pid)
|
||||||
rescue Errno::ECHILD, Errno::ESRCH
|
rescue Errno::ECHILD, Errno::ESRCH
|
||||||
|
log 'Rabbit Carrots already stopped'
|
||||||
end
|
end
|
||||||
|
|
||||||
def monitor_puma
|
def monitor_puma
|
||||||
@ -57,7 +58,7 @@ Puma::Plugin.create do
|
|||||||
loop do
|
loop do
|
||||||
if send(process_dead)
|
if send(process_dead)
|
||||||
log message
|
log message
|
||||||
Process.kill('TERM', $$)
|
Process.kill('TERM', $PROCESS_ID)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|||||||
@ -18,8 +18,8 @@ module RabbitCarrots
|
|||||||
:rabbitmq_exchange_name,
|
:rabbitmq_exchange_name,
|
||||||
:automatically_recover,
|
:automatically_recover,
|
||||||
:network_recovery_interval,
|
:network_recovery_interval,
|
||||||
:recovery_attempts,
|
:recovery_attempts
|
||||||
:orm
|
|
||||||
def orm
|
def orm
|
||||||
@orm ||= :activerecord
|
@orm ||= :activerecord
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user