run method

Future<void> run()

Implementation

Future<void> run() async {
  final stopwatch = Stopwatch()..start();
  if (_runCompleter != null) {
    throw ApiError('ApplicationHost already running.');
  }
  final completer = _runCompleter = Completer();

  _signalSubscription = Rx.merge([
    ProcessSignal.sigint.watch(),
    ProcessSignal.sigterm.watch(),
  ]).listen(_onSignal);

  await initialize();

  stopwatch.stop();
  findComponent(Find<Telemetry?>(), null)?.publishLog(
    LogMessage(
      timestamp: DateTime.timestamp(),
      line: 'Initialized in ${stopwatch.elapsedMilliseconds}ms.',
      level: SeverityLevel.info,
    ),
  );

  return completer.future;
}