run method
Implementation
@override
Future<dynamic> run() async {
Map<String, StatusActionTest> checks = {};
for (var key in allChecks.keys) {
try {
checks.addAll(await allChecks[key]!.check(this));
} catch (e) {
checks[key] = StatusActionTest(false, value: e.toString());
}
}
_uptimeTimer ??= DateTime.now();
var healthy = checks.values.map((a) => a.isOk).reduce((a, b) => a && b);
if (!healthy) {
responseStatus = HttpStatus.serviceUnavailable;
}
var now = DateTime.now();
Map checksInfo = {};
checks.forEach((key, value) {
checksInfo[key] = {'ok': value.isOk, 'value': value.value};
});
return {'time': now.toString(), 'uptime': now.difference(_uptimeTimer!).inSeconds.toDouble() / (60 * 60 * 24), 'healthy': healthy, 'checks': checksInfo};
}