Skip to content

Instantly share code, notes, and snippets.

@iamer

iamer/gist:1446483

Created Dec 8, 2011
Embed
What would you like to do?
ruote shutdown case
In one process
$engine = Ruote::Engine.new(
Ruote::Worker.new(
Ruote::FsStorage.new(ENV['SERVER_DATABASE'])
)
)
In another process
# Use the correct store type
$engine = Ruote::Engine.new(
Ruote::FsStorage.new(route_db)
)
Signal.trap('SIGTERM') do
puts 'Shutdown gracefully'
$engine.shutdown
puts 'Asked engine to stop'
$engine.join
# Rack doesn't act on SIGTERM
puts 'Sending SIGINT to stop Rack'
Process.kill("SIGINT", Process.pid)
end
Before patch SIGTERM produced :
2011-12-08 10:46:29.032062500 /usr/lib/ruby/vendor_ruby/ruote/dashboard.rb:109:in `worker': undefined method `worker' for #<Ruote::Context:0x7f702c4ede70> (NoMethodError)
2011-12-08 10:46:29.040735500 from /usr/lib/ruby/vendor_ruby/ruote/dashboard.rb:501:in `join'
2011-12-08 10:46:29.040736500 from /var/lib/boss-viewer/boss-viewer.ru:27
2011-12-08 10:46:29.040736500 from /usr/lib/ruby/1.8/webrick/utils.rb:63:in `call'
2011-12-08 10:46:29.040737500 from /usr/lib/ruby/1.8/webrick/utils.rb:63:in `create_listeners'
2011-12-08 10:46:29.040738500 from /usr/lib/ruby/1.8/webrick/server.rb:75:in `listen'
2011-12-08 10:46:29.040738500 from /usr/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
2011-12-08 10:46:29.040739500 from /usr/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
2011-12-08 10:46:29.040796500 from /usr/lib/ruby/vendor_ruby/rack/handler/webrick.rb:10:in `new'
2011-12-08 10:46:29.040797500 from /usr/lib/ruby/vendor_ruby/rack/handler/webrick.rb:10:in `run'
2011-12-08 10:46:29.040797500 from /usr/lib/ruby/vendor_ruby/rack/server.rb:265:in `start'
2011-12-08 10:46:29.040798500 from /usr/lib/ruby/vendor_ruby/rack/server.rb:137:in `start'
2011-12-08 10:46:29.040798500 from /usr/bin/rackup:4
with line completely removed
@400000004ee07df21727259c [2011-12-08 11:05:44] ERROR NoMethodError: undefined method `worker' for #<Ruote::Context:0x7f27b4ad3e40>
@400000004ee07df217272d6c /usr/lib/ruby/vendor_ruby/ruote/dashboard.rb:108:in `worker'
After patch it works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.