RuntimeHealthCheck.compute constructor
RuntimeHealthCheck.compute({})
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,
);
}