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 to use $$ instead of $PROCESS_ID for improved compatibility
This commit is contained in:
parent
cb41e257fc
commit
ac06deb86a
@ -1,5 +1,4 @@
|
|||||||
# rabbit_carrots.rb
|
# rabbit_carrots.rb
|
||||||
require 'English'
|
|
||||||
require 'puma/plugin'
|
require 'puma/plugin'
|
||||||
require 'rabbit_carrots'
|
require 'rabbit_carrots'
|
||||||
|
|
||||||
@ -8,7 +7,7 @@ Puma::Plugin.create do
|
|||||||
|
|
||||||
def start(launcher)
|
def start(launcher)
|
||||||
@log_writer = launcher.log_writer
|
@log_writer = launcher.log_writer
|
||||||
@puma_pid = $PROCESS_ID
|
@puma_pid = $$
|
||||||
|
|
||||||
@core_service = RabbitCarrots::Core.new(logger: log_writer)
|
@core_service = RabbitCarrots::Core.new(logger: log_writer)
|
||||||
|
|
||||||
@ -58,7 +57,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_ID)
|
Process.kill('TERM', $$)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user