Class: Alondra::Alondra
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- Alondra::Alondra
- Defined in:
- lib/alondra.rb
Class Method Summary collapse
Class Method Details
.die_gracefully_on_signal ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/alondra.rb', line 76 def self.die_gracefully_on_signal Signal.trap("INT") do Log.warn "INT signal trapped. Shutting down EM reactor" EM.stop end Signal.trap("TERM") do Log.warn "TERM signal trapped. Shutting down EM reactor" EM.stop end end |
.start_server! ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/alondra.rb', line 60 def self.start_server! start_server_proc = Proc.new do MessageQueue.instance.start_listening Server.run die_gracefully_on_signal end if EM.reactor_running? EM.schedule(start_server_proc) else Log.info "starting EM reactor" EM.run(start_server_proc) end end |
.start_server_in_new_thread! ⇒ Object
54 55 56 57 58 |
# File 'lib/alondra.rb', line 54 def self.start_server_in_new_thread! Thread.new do start_server! end end |