You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm expecting the at_exit block from the worker class to be executed, but it's not
require 'serverengine'
module Worker
extend self
def run
@stopped = false
at_exit do
puts 'Running at_exit hook!' # not printed
end
trap 'TERM' do
@stopped = true
end
until @stopped
puts 'Super hard work!'
sleep 1
end
end
end
ServerEngine.create nil, Worker do
{
log: '-',
worker_type: 'process',
}
end.run
It seems that at_exit hooks are explicitly disabled in the ProcessManager#fork by using Kernel.exit! in the child process. Is there a reason for not allowing the hooks to be run?
P.S I'm aware of the ServerEngine::Worker#stop hook, but the idea is to have the application code (Rails) decide what to install as exit hooks.
The text was updated successfully, but these errors were encountered:
👋
I'm expecting the
at_exit
block from the worker class to be executed, but it's notIt seems that
at_exit
hooks are explicitly disabled in the ProcessManager#fork by usingKernel.exit!
in the child process. Is there a reason for not allowing the hooks to be run?P.S I'm aware of the
ServerEngine::Worker#stop
hook, but the idea is to have the application code (Rails) decide what to install as exit hooks.The text was updated successfully, but these errors were encountered: