class Async::Container::Supervisor::Service
def endpoint
The endpoint which the supervisor will bind to.
def endpoint @evaluator.endpoint end
def initialize(...)
Initialize the supervisor using the given environment.
def initialize(...) super @bound_endpoint = nil end
def name
def name @evaluator.name end
def setup(container)
def setup(container) container_options = @evaluator.container_options health_check_timeout = container_options[:health_check_timeout] container.run(name: self.name, **container_options) do |instance| evaluator = @environment.evaluator Async do server = evaluator.make_server(@bound_endpoint) server.run instance.ready! if health_check_timeout Async(transient: true) do while true sleep(health_check_timeout / 2) instance.ready! end end end end end super end
def start
def start @bound_endpoint = self.endpoint.bound super end
def stop
def stop @bound_endpoint&.close @bound_endpoint = nil super end