check method

Future<Map<String, StatusActionTest>> check(
  1. StatusAction action
)
override

Implementation

Future<Map<String,StatusActionTest>> check(StatusAction action) async {
  int serviceId = server.config.getRequired<int>('service_id');
  var lastRun = await action.db.fetchOne<DateTime>(
      'SELECT last_run FROM run_jobs WHERE app_id = ? AND job = ?',
      [ serviceId, 'Ticker' ]
  );
  var ret = false;
  if (lastRun != null) {
    ret = new DateTime.now().difference(lastRun).inSeconds < 65;
  }
  return {'ticker' : StatusActionTest(ret, value: lastRun.toString())};
}