diff --git a/rust/riverqueue/README.md b/rust/riverqueue/README.md index 50f424a06..e2cf5e83b 100644 --- a/rust/riverqueue/README.md +++ b/rust/riverqueue/README.md @@ -83,7 +83,7 @@ async fn main() -> Result<(), Box> { .queue("default", QueueConfig::new(10)) .build()?; // Work jobs until Ctrl-C, then stop fetching and let running jobs finish. - let mut run = client.start_with_graceful_shutdown(async { + let mut run = client.start_with_graceful_stop(async { let _ = tokio::signal::ctrl_c().await; })?; diff --git a/rust/riverqueue/src/client/builder.rs b/rust/riverqueue/src/client/builder.rs index 4b62f1a80..a53c20565 100644 --- a/rust/riverqueue/src/client/builder.rs +++ b/rust/riverqueue/src/client/builder.rs @@ -570,7 +570,7 @@ impl ClientBuilder { /// The client starts this timer when fetching stops, however the stop was /// requested: [`RunHandle::stop`](crate::RunHandle::stop), /// [`Stopper::stop`](crate::Stopper::stop), or the signal passed to - /// [`Client::start_with_graceful_shutdown`]. Jobs still running when it + /// [`Client::start_with_graceful_stop`]. Jobs still running when it /// expires are cancelled as if by /// [`Stopper::stop_and_cancel`](crate::Stopper::stop_and_cancel). #[must_use] diff --git a/rust/riverqueue/src/client/run.rs b/rust/riverqueue/src/client/run.rs index be8cef96a..251057a7e 100644 --- a/rust/riverqueue/src/client/run.rs +++ b/rust/riverqueue/src/client/run.rs @@ -73,7 +73,7 @@ impl Client { /// /// ```no_run /// # async fn example(client: riverqueue::Client) -> Result<(), riverqueue::Error> { - /// let mut run = client.start_with_graceful_shutdown(async { + /// let mut run = client.start_with_graceful_stop(async { /// let _ = tokio::signal::ctrl_c().await; /// })?; /// // Returns after Ctrl-C once in-flight jobs have finished. @@ -84,7 +84,7 @@ impl Client { /// # Errors /// /// Returns the same errors as [`Client::start`]. - pub fn start_with_graceful_shutdown(&self, signal: F) -> Result + pub fn start_with_graceful_stop(&self, signal: F) -> Result where F: std::future::Future + Send + 'static, { @@ -565,7 +565,7 @@ impl Stopper { /// handle as they were, apart from any stop the method already requested. To /// stop the client from another task, obtain a [`Stopper`] with /// [`RunHandle::stopper`] or start the client with -/// [`Client::start_with_graceful_shutdown`]. +/// [`Client::start_with_graceful_stop`]. /// /// The client's result is reported to the first call that observes it /// stopping; later calls return `Ok(())`. @@ -627,7 +627,7 @@ impl RunHandle { /// /// This relinquishes waiting for the client: it runs until a [`Stopper`] /// obtained earlier from [`RunHandle::stopper`] or the signal passed to - /// [`Client::start_with_graceful_shutdown`] stops it, an essential service + /// [`Client::start_with_graceful_stop`] stops it, an essential service /// fails, or the process exits. Nothing observes its result, and jobs /// running when the process exits are left `running` for the rescuer. /// Most applications should keep the handle and await diff --git a/rust/riverqueue/tests/lifecycle.rs b/rust/riverqueue/tests/lifecycle.rs index cc4264f33..842409182 100644 --- a/rust/riverqueue/tests/lifecycle.rs +++ b/rust/riverqueue/tests/lifecycle.rs @@ -1,4 +1,4 @@ -//! Client lifecycle: stopping from other tasks, graceful shutdown signals, +//! Client lifecycle: stopping from other tasks, graceful stop signals, //! cancel safety, and idempotency. //! //! Lifecycle behavior doesn't depend on the backend, so these tests use @@ -246,13 +246,13 @@ async fn dropping_the_handle_requests_a_hard_stop() { } #[tokio::test(flavor = "multi_thread")] -async fn graceful_shutdown_signal_accepts_a_cancellation_token() { +async fn graceful_stop_signal_accepts_a_cancellation_token() { let database = TestDatabase::new().await; let client = database.client(&Gate::new(), 1); let token = CancellationToken::new(); let mut run = client - .start_with_graceful_shutdown(token.clone().cancelled_owned()) + .start_with_graceful_stop(token.clone().cancelled_owned()) .unwrap(); run.wait_ready().await.unwrap(); token.cancel(); @@ -260,7 +260,7 @@ async fn graceful_shutdown_signal_accepts_a_cancellation_token() { } #[tokio::test(flavor = "multi_thread")] -async fn graceful_shutdown_signal_stops_softly() { +async fn graceful_stop_signal_stops_softly() { let database = TestDatabase::new().await; let gate = Gate::new(); let client = database.client(&gate, 1); @@ -268,7 +268,7 @@ async fn graceful_shutdown_signal_stops_softly() { let (signal_sender, signal) = oneshot::channel::<()>(); let mut run = client - .start_with_graceful_shutdown(async move { + .start_with_graceful_stop(async move { let _ = signal.await; }) .unwrap();