Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): check redis master connection in health endpoint #1612

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ async fn reset_active(
Ok(StatusCode::OK)
}

async fn check_health(State(mut state): State<AppState>) -> StatusCode {
if state.replicas.check_connection() {
return StatusCode::OK;
async fn check_health(State(mut state): State<AppState>) -> Result<StatusCode, AppError> {
if !state.replicas.check_connection() {
return Ok(StatusCode::INTERNAL_SERVER_ERROR);
}
StatusCode::INTERNAL_SERVER_ERROR
state.master.get::<&str, i32>("active_boards").await?;
Ok(StatusCode::OK)
}

async fn active_boards(
Expand Down