RuntimeHealthCheck.compute constructor

RuntimeHealthCheck.compute({
  1. bool coordinatorBusy = false,
  2. int retryQueueDepth = 0,
  3. String? reconnectState,
  4. bool transactionInProgress = false,
  5. bool schedulerRunning = false,
  6. bool? persistenceHealthy,
})

Implementation

factory RuntimeHealthCheck.compute({
  bool coordinatorBusy = false,
  int retryQueueDepth = 0,
  String? reconnectState,
  bool transactionInProgress = false,
  bool schedulerRunning = false,
  bool? persistenceHealthy,
}) {
  final RuntimeHealthState state;
  if (reconnectState == 'failed' || reconnectState == 'abandoned') {
    state = RuntimeHealthState.reconnectFailed;
  } else if (reconnectState == 'reconnecting') {
    state = RuntimeHealthState.reconnecting;
  } else if (transactionInProgress || coordinatorBusy) {
    state = RuntimeHealthState.transactionActive;
  } else if (retryQueueDepth > 0) {
    state = RuntimeHealthState.retriesPending;
  } else {
    state = RuntimeHealthState.healthy;
  }
  return RuntimeHealthCheck(
    state: state,
    coordinatorBusy: coordinatorBusy,
    retryQueueDepth: retryQueueDepth,
    reconnectState: reconnectState,
    transactionInProgress: transactionInProgress,
    schedulerRunning: schedulerRunning,
    persistenceHealthy: persistenceHealthy,
  );
}