Proper SIGINT handling from ruby rpc_server
This commit is contained in:
parent
e4b167cc0e
commit
b0a44e3b4e
@ -12,6 +12,12 @@ AMQP.start(:host => "localhost") do |connection|
|
||||
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|
|
||||
|
Loading…
Reference in New Issue
Block a user