diff --git a/examples/src/health/server.rs b/examples/src/health/server.rs index 7b12e8668..4ae198d51 100644 --- a/examples/src/health/server.rs +++ b/examples/src/health/server.rs @@ -29,7 +29,7 @@ impl Greeter for MyGreeter { /// This function (somewhat improbably) flips the status of a service every second, in order /// that the effect of `tonic_health::HealthReporter::watch` can be easily observed. -async fn twiddle_service_status(mut reporter: HealthReporter) { +async fn twiddle_service_status(reporter: HealthReporter) { let mut iter = 0u64; loop { iter += 1; @@ -45,7 +45,7 @@ async fn twiddle_service_status(mut reporter: HealthReporter) { #[tokio::main] async fn main() -> Result<(), Box> { - let (mut health_reporter, health_service) = tonic_health::server::health_reporter(); + let (health_reporter, health_service) = tonic_health::server::health_reporter(); health_reporter .set_serving::>() .await; diff --git a/tonic-health/src/server.rs b/tonic-health/src/server.rs index 7cae885ff..a512b60fd 100644 --- a/tonic-health/src/server.rs +++ b/tonic-health/src/server.rs @@ -48,7 +48,7 @@ impl HealthReporter { /// Sets the status of the service implemented by `S` to `Serving`. This notifies any watchers /// if there is a change in status. - pub async fn set_serving(&mut self) + pub async fn set_serving(&self) where S: NamedService, { @@ -59,7 +59,7 @@ impl HealthReporter { /// Sets the status of the service implemented by `S` to `NotServing`. This notifies any watchers /// if there is a change in status. - pub async fn set_not_serving(&mut self) + pub async fn set_not_serving(&self) where S: NamedService, { @@ -70,7 +70,7 @@ impl HealthReporter { /// Sets the status of the service with `service_name` to `status`. This notifies any watchers /// if there is a change in status. - pub async fn set_service_status(&mut self, service_name: S, status: ServingStatus) + pub async fn set_service_status(&self, service_name: S, status: ServingStatus) where S: AsRef, { @@ -220,7 +220,7 @@ mod tests { #[tokio::test] async fn test_service_check() { - let (mut reporter, service) = make_test_service().await; + let (reporter, service) = make_test_service().await; // Overall server health let resp = service