module NFAgent class Server def run Log.info("Starting up") chunk_handler = ChunkHandler.new poller = Poller.new EM.run { EM.start_server "0.0.0.0", 10000, Event, chunk_handler, poller EM::PeriodicTimer.new(5) do chunk_handler.check_full_or_expired end EM::PeriodicTimer.new(120) do poller.send_heartbeat end EM::fork_reactor do EM::PeriodicTimer.new(60) do Submitter.resubmit_failed_dumps end end } end def shutdown EM::stop_event_loop if EM::reactor_running? end end end