Skip to content

Commit 3dc03c9

Browse files
toydestroyerrosa
authored andcommitted
Add support for new Puma 7 hook names
1 parent a459caa commit 3dc03c9

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

lib/puma/plugin/solid_queue.rb

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,27 @@ def start(launcher)
1111
monitor_solid_queue
1212
end
1313

14-
launcher.events.on_booted do
15-
@solid_queue_pid = fork do
16-
Thread.new { monitor_puma }
17-
SolidQueue::Supervisor.start
14+
if Gem::Version.new(Puma::Const::VERSION) < Gem::Version.new("7")
15+
launcher.events.on_booted do
16+
@solid_queue_pid = fork do
17+
Thread.new { monitor_puma }
18+
SolidQueue::Supervisor.start
19+
end
20+
end
21+
22+
launcher.events.on_stopped { stop_solid_queue }
23+
launcher.events.on_restart { stop_solid_queue }
24+
else
25+
launcher.events.after_booted do
26+
@solid_queue_pid = fork do
27+
Thread.new { monitor_puma }
28+
SolidQueue::Supervisor.start
29+
end
1830
end
19-
end
2031

21-
launcher.events.on_stopped { stop_solid_queue }
22-
launcher.events.on_restart { stop_solid_queue }
32+
launcher.events.after_stopped { stop_solid_queue }
33+
launcher.events.before_restart { stop_solid_queue }
34+
end
2335
end
2436

2537
private

0 commit comments

Comments
 (0)