Class: Docscribe::Server::Daemon
- Inherits:
-
Object
- Object
- Docscribe::Server::Daemon
- Defined in:
- lib/docscribe/server.rb
Overview
Daemon process that loads the Ruby runtime once and serves requests.
Instance Method Summary collapse
- #initialize(socket_path: nil, idle_timeout: IDLE_TIMEOUT, config_path: nil) ⇒ void constructor
-
#start ⇒ void
Start the daemon: load dependencies, bind socket, enter listen loop.
Constructor Details
#initialize(socket_path: nil, idle_timeout: IDLE_TIMEOUT, config_path: nil) ⇒ void
339 340 341 342 343 344 345 346 347 348 |
# File 'lib/docscribe/server.rb', line 339 def initialize(socket_path: nil, idle_timeout: IDLE_TIMEOUT, config_path: nil) @socket_path = socket_path || Server.socket_path(config_path) @idle_timeout = idle_timeout @config_path = config_path @last_request_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) @running = false @server = nil @file_cache = LRUCache.new @started_at = Time.now end |
Instance Method Details
#start ⇒ void
This method returns an undefined value.
Start the daemon: load dependencies, bind socket, enter listen loop.
353 354 355 356 357 358 359 360 |
# File 'lib/docscribe/server.rb', line 353 def start load_dependencies setup_socket @running = true $PROGRAM_NAME = "docscribe server (#{Dir.pwd})" write_pid listen_loop end |