From 38ca7d3927dda74f7ae5ca37bc4f8750e7046f62 Mon Sep 17 00:00:00 2001 From: Ari Karim Date: Sun, 25 May 2025 14:08:25 +0300 Subject: [PATCH 1/3] Updates rabbit_carrots to version 1.0.4 and adds 'English' module requirement in the Puma plugin --- Gemfile.lock | 2 +- lib/puma/plugin/rabbit_carrots.rb | 2 +- lib/rabbit_carrots/version.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5492aa4..a92a166 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rabbit_carrots (1.0.3) + rabbit_carrots (1.0.4) bunny (>= 2.22) connection_pool (~> 2.4) diff --git a/lib/puma/plugin/rabbit_carrots.rb b/lib/puma/plugin/rabbit_carrots.rb index e4301ea..79fd20f 100644 --- a/lib/puma/plugin/rabbit_carrots.rb +++ b/lib/puma/plugin/rabbit_carrots.rb @@ -1,5 +1,5 @@ # rabbit_carrots.rb - +require 'English' require 'puma/plugin' require 'rabbit_carrots' diff --git a/lib/rabbit_carrots/version.rb b/lib/rabbit_carrots/version.rb index 55c2024..a05e114 100644 --- a/lib/rabbit_carrots/version.rb +++ b/lib/rabbit_carrots/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module RabbitCarrots - VERSION = '1.0.3' + VERSION = '1.0.4' end From cb41e257fc6301708522637836f1a0e4aac6d2e9 Mon Sep 17 00:00:00 2001 From: Ari Karim Date: Sun, 25 May 2025 14:10:40 +0300 Subject: [PATCH 2/3] Enhances logging functionality by adding additional log level methods (info, warn) to the adapter in Rabbit Carrots core module --- lib/rabbit_carrots/core.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rabbit_carrots/core.rb b/lib/rabbit_carrots/core.rb index 4297092..c77f286 100644 --- a/lib/rabbit_carrots/core.rb +++ b/lib/rabbit_carrots/core.rb @@ -125,12 +125,15 @@ module RabbitCarrots def adapter.info(msg) @logger.write("[INFO] #{msg}\n") end + def adapter.error(msg) @logger.write("[ERROR] #{msg}\n") end + def adapter.warn(msg) @logger.write("[WARN] #{msg}\n") end + adapter.instance_variable_set(:@logger, logger) adapter end From ac06deb86aa5d9fd6c349a912474a87d1191683b Mon Sep 17 00:00:00 2001 From: Ari Karim Date: Sun, 25 May 2025 15:14:30 +0300 Subject: [PATCH 3/3] Refactors process ID handling in Rabbit Carrots plugin to use $$ instead of $PROCESS_ID for improved compatibility --- lib/puma/plugin/rabbit_carrots.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/puma/plugin/rabbit_carrots.rb b/lib/puma/plugin/rabbit_carrots.rb index 79fd20f..3344c16 100644 --- a/lib/puma/plugin/rabbit_carrots.rb +++ b/lib/puma/plugin/rabbit_carrots.rb @@ -1,5 +1,4 @@ # rabbit_carrots.rb -require 'English' require 'puma/plugin' require 'rabbit_carrots' @@ -8,7 +7,7 @@ Puma::Plugin.create do def start(launcher) @log_writer = launcher.log_writer - @puma_pid = $PROCESS_ID + @puma_pid = $$ @core_service = RabbitCarrots::Core.new(logger: log_writer) @@ -58,7 +57,7 @@ Puma::Plugin.create do loop do if send(process_dead) log message - Process.kill('TERM', $PROCESS_ID) + Process.kill('TERM', $$) break end sleep 2