Skip to content

Commit

Permalink
Proper SIGINT handling from ruby rpc_server
Browse files Browse the repository at this point in the history
  • Loading branch information
majek committed Jul 7, 2011
1 parent e4b167c commit b0a44e3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ruby/rpc_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down

0 comments on commit b0a44e3

Please sign in to comment.