Skip to content
Browse files

Proper SIGINT handling from ruby rpc_server

  • Loading branch information...
1 parent e4b167c commit b0a44e3b4e70ba45dddab80e149ec1e879ac8e81 @majek majek committed Jul 7, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 ruby/rpc_server.rb
View
6 ruby/rpc_server.rb
@@ -12,6 +12,12 @@ def fib(n)
channel = AMQP::Channel.new(connection)
queue = channel.queue("rpc_queue")
+ Signal.trap("INT") do
+ connection.close do
+ EM.stop { exit }
+ end
+ end
+
channel.prefetch(1)
queue.subscribe(:ack => true) do |header, body|

0 comments on commit b0a44e3

Please sign in to comment.
Something went wrong with that request. Please try again.