Skip to content

Commit

Permalink
reflect updating a server's health check period
Browse files Browse the repository at this point in the history
Signed-off-by: mario <[email protected]>
  • Loading branch information
MarioBassem committed Dec 11, 2023
1 parent 13c781a commit 33025e3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/balancer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,24 @@ impl Balancer {
}
APIRequest::UpdateServer(server) => {
let url = server.url.clone();
let period = server.health_check_period;
self.update_server(server)
.map_err(|e| APIResponse::Error(StatusCode::BAD_REQUEST, e.to_string()))?;

log::info!("server {:?} was updated", url);
health_check_request_tx
.send(HealthCheckRequest::Stop(url.clone()))
.await
.map_err(|e| {
APIResponse::Error(StatusCode::INTERNAL_SERVER_ERROR, e.to_string())
})?;

health_check_request_tx
.send(HealthCheckRequest::Start(url, period))
.await
.map_err(|e| {
APIResponse::Error(StatusCode::INTERNAL_SERVER_ERROR, e.to_string())
})?;
}
}

Expand Down

0 comments on commit 33025e3

Please sign in to comment.