class Puma::DSL
def on_thread_exit(&block)
puts 'On thread exit...'
on_thread_exit do
@example
This can be called multiple times to add several hooks.
is trimmed.
This hook is useful for cleaning up thread local resources when a thread
Raising an exception will log a warning.
Return values are ignored.
It does not run when a thread dies due to exceptions or any other cause.
This hook only runs when a thread in the threadpool is trimmed by Puma.
blocked, so no new requests will be picked up.
pool. Be careful: while this block executes, Puma's main loop is
Provide a block to be executed after a thread is trimmed from the thread
def on_thread_exit(&block) @options[:before_thread_exit] ||= [] @options[:before_thread_exit] << block end