diff --git a/actix-rt/CHANGES.md b/actix-rt/CHANGES.md index 642cf27a..0ac9f24a 100644 --- a/actix-rt/CHANGES.md +++ b/actix-rt/CHANGES.md @@ -1,6 +1,9 @@ # Changes ## Unreleased - 2021-xx-xx +* Add `Arbiter::try_current` for situations where thread may or may not have Arbiter context. [#408] + +[#408]: https://github.com/actix/actix-net/pull/408 ## 2.3.0 - 2021-10-11 diff --git a/actix-rt/src/arbiter.rs b/actix-rt/src/arbiter.rs index ec336cbf..43b1bdc3 100644 --- a/actix-rt/src/arbiter.rs +++ b/actix-rt/src/arbiter.rs @@ -244,7 +244,7 @@ impl Arbiter { /// /// Returns `None` if no Arbiter has been started. /// - /// Contrary to [`current`](Self::current), this never panics. + /// Unlike [`current`](Self::current), this never panics. pub fn try_current() -> Option { HANDLE.with(|cell| cell.borrow().clone()) } diff --git a/actix-rt/src/system.rs b/actix-rt/src/system.rs index ebe0b347..e32d6209 100644 --- a/actix-rt/src/system.rs +++ b/actix-rt/src/system.rs @@ -130,7 +130,7 @@ impl System { /// /// Returns `None` if no System has been started. /// - /// Contrary to [`current`](Self::current), this never panics. + /// Unlike [`current`](Self::current), this never panics. pub fn try_current() -> Option { CURRENT.with(|cell| cell.borrow().clone()) } diff --git a/actix-server/src/server.rs b/actix-server/src/server.rs index 3b37248e..4122de6b 100644 --- a/actix-server/src/server.rs +++ b/actix-server/src/server.rs @@ -260,7 +260,7 @@ impl ServerInner { self.waker_queue.wake(WakerInterest::Stop); // stop workers - let stop = self + let workers_stop = self .worker_handles .iter() .map(|worker| worker.stop(graceful)) @@ -269,7 +269,7 @@ impl ServerInner { Some(Box::pin(async move { if graceful { // wait for all workers to shut down - let _ = join_all(stop).await; + let _ = join_all(workers_stop).await; } if let Some(tx) = completion {