Replies: 1 comment 2 replies
-
It looks like @johnnyshields made it up in #3363 and I did not catch it! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, maybe someone here will know this, but I can't find the answer after searching.
Puma::Events
defines three hooks for the lifecycle of a server:#on_booted
,#on_restart
, and#on_stopped
. Each takes a block to execute when this event occurs.In
Puma::DSL
, there's an implementation of#on_booted
and#on_restart
, but nothing for#on_stopped
. (Curiously, the two existing event hook methods are slightly different in implementation, but I didn't dig further to figure out why.)Additionally, the
README
itself refers prominently toon_stopped
. But of course that method does not exist in the DSL, so you get the following error:Is this possibly just an oversight of some kind? Or maybe the method was removed for whatever reason, but the documentation remained in place?
The reason I'm interested is that, where I work, we run Puma in single mode for now, and we want to flush Kafka events from the producer's buffer when the process receives
SIGTERM
before stopping. Otherwise, we may drop buffered messages on the floor. Right now, our options seem to be:Puma::Events
(maybe overkill for a one-liner?).config/puma.rb
which digs the object out of the DSL configuration (e.g.,instance_var_get(:@config).events.on_stopped
).SIGTERM
handler, independent of Puma.I'm not sure which option is best. Any thoughts?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions