mirror of
https://github.com/jimeh/amqp-failover.git
synced 2026-02-19 10:56:44 +00:00
major restructuring, specs probably all break
right now
This commit is contained in:
@@ -16,3 +16,21 @@ module ServerHelper
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Helper methods
|
||||
#
|
||||
|
||||
def start_server(port = 15762, timeout = 2)
|
||||
bef_fork = EM.forks.clone
|
||||
EM.fork {
|
||||
EM.start_server('localhost', port, ServerHelper)
|
||||
EM.add_timer(timeout) { EM.stop }
|
||||
}
|
||||
(EM.forks - bef_fork).first
|
||||
end
|
||||
|
||||
def stop_server(pid)
|
||||
Process.kill('TERM', pid)
|
||||
end
|
||||
Reference in New Issue
Block a user