Class: GoodJob::ProbeServer::SimpleHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/good_job/probe_server/simple_handler.rb

Constant Summary collapse

SOCKET_READ_TIMEOUT =

in seconds

5

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ SimpleHandler

Returns a new instance of SimpleHandler.



8
9
10
11
12
13
14
# File 'lib/good_job/probe_server/simple_handler.rb', line 8

def initialize(app, options = {})
  @app    = app
  @port   = options[:port]
  @logger = options[:logger]

  @running = Concurrent::AtomicBoolean.new(false)
end

Instance Method Details

#build_futureObject



25
26
27
# File 'lib/good_job/probe_server/simple_handler.rb', line 25

def build_future
  Concurrent::Future.new { run }
end

#running?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/good_job/probe_server/simple_handler.rb', line 21

def running?
  @running.true?
end

#stopObject



16
17
18
19
# File 'lib/good_job/probe_server/simple_handler.rb', line 16

def stop
  @running.make_false
  @server&.close
end