rails/solid_queue

`monitor_solid_queue` not working on Puma Plugin

Opened this issue · 0 comments

Hi🖐️
I'm using the puma plugin to start a solid_queue supervisor.
To make sure that puma is monitoring the supervisor, I kill the supervisor process, but the puma process does not terminate.
Possible causes,
In the solid_queue puma plugin, the registration to the background is done in the hook of the boot event, and puma executes the function registered in the background before boot, so I think that monitor_solid_queue is not being executed.

monitor_solid_queue

If the registration to the background was done outside of the boot event hook, monitor_solid_queue seemed to be executed.

  def start(launcher)
    @log_writer = launcher.log_writer
    @puma_pid = $$

    launcher.events.on_booted do
      @solid_queue_pid = fork do
        Thread.new { monitor_puma }
        SolidQueue::Supervisor.start(mode: :all)
      end
    end

    launcher.events.on_stopped { stop_solid_queue }
    launcher.events.on_restart { stop_solid_queue }

    in_background do
      monitor_solid_queue
    end
  end

Solid Queue: 0.3.0
Ruby: 3.2.2
Puma: 6.4.2

Thanks