Module: Anycablebility::RPC
- Defined in:
- lib/anycablebility/rpc.rb
Overview
Runs AnyCable RPC server in the background
Class Attribute Summary collapse
-
.running ⇒ Object
Returns the value of attribute running.
Class Method Summary collapse
Class Attribute Details
.running ⇒ Object
Returns the value of attribute running.
12 13 14 |
# File 'lib/anycablebility/rpc.rb', line 12 def running @running end |
Class Method Details
.running? ⇒ Boolean
31 32 33 |
# File 'lib/anycablebility/rpc.rb', line 31 def running? Anycable::Server.grpc_server&.running_state == :running end |
.start ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/anycablebility/rpc.rb', line 14 def start Anycable.logger.debug "Starting RPC server ..." @thread = Thread.new { Anycable::Server.start } @thread.abort_on_exception = true wait(2) { running? } Anycable.logger.debug "RPC server started" end |
.stop ⇒ Object
25 26 27 28 29 |
# File 'lib/anycablebility/rpc.rb', line 25 def stop return unless running? Anycable::Server.grpc_server.stop end |