Class: Async::App
Defined Under Namespace
Modules: Component, Injector
Classes: EventLogger, WebServer
Instance Method Summary
collapse
Methods included from Injector
inject
Constructor Details
#initialize ⇒ App
rubocop:disable Style/GlobalVars
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/async/app.rb', line 11
def initialize
raise "only one instance of #{self.class} is allowed" if $__ASYNC_APP
$__ASYNC_APP = self
@task = Async::Task.current
set_traps!
init_container!
start_event_logger!
start_web_server!
start_runtime_metrics_collector!
run!
info { "Started" }
bus.publish("health.updated", true)
rescue StandardError => e
fatal { e }
stop
exit(1)
end
|
Instance Method Details
#app_name ⇒ Object
38
|
# File 'lib/async/app.rb', line 38
def app_name = :async_app
|
#container ⇒ Object
35
|
# File 'lib/async/app.rb', line 35
def container = @container ||= Dry::Container.new
|
#container_config ⇒ Object
37
|
# File 'lib/async/app.rb', line 37
def container_config = {}
|
#run! ⇒ Object
36
|
# File 'lib/async/app.rb', line 36
def run! = nil
|
#stop ⇒ Object
40
41
42
43
44
|
# File 'lib/async/app.rb', line 40
def stop
@task&.stop
$__ASYNC_APP = nil
info { "Stopped" }
end
|