Hi Aditya
The default timeout on my Rails app is 30 seconds. The app works fine
most of the time but there are some parts of the app which are slow
and occasionally totter over the 30 sec response time and timeout. Is
there a clean way for me to hook into timeouts and notify myself when
timeouts occur? Something like a chance to email myself or send an
airbrake notification?
In your unicorn config.rb file, this example would email a snapshot of
top output when a worker times out:
before_fork do |server, worker|
`tail -n 5 "#{log_path}/unicorn.log"`.split("\n").each do |line|
next unless line =~ /SIGKILL.*worker=(\d+)$/
worker_nr = $1
next unless worker_nr = worker.nr
`top -n1 -b | mail -s "#{line}" [email protected]`
break
end
# …
end
Cheers,
Lawrence
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying