run method

Future run()
override

Implementation

Future<dynamic> run() async
{
  Map<String, bool> checks = {};
  for (var key in allChecks.keys) {
    try {
      checks.addAll(await allChecks[key]!.check());
    } catch (e) {
      checks[key] = false;
    }
  }

  var healthy = checks.values.reduce((a, b) => a && b);
  if (!healthy) {
    this.responseStatus = HttpStatus.serviceUnavailable;
  }
  return {
    'time': DateTime.now().toString(),
    'healthy': healthy,
    'checks': checks
  };
}