pub struct HealthTick {
handle: JoinHandle<()>,
stop: Arc<Notify>,
state: Arc<HealthState>,
}Expand description
A running health tick, stopped by HealthTick::stop or by dropping it.
The task holds only an Arc<dyn Registry> and never keeps the process
alive on its own: a tokio task dies with its runtime, and this handle
aborts it on drop so a server that has finished shutting down does not
leave a timer writing lines about a registry nobody is serving.
Fields§
§handle: JoinHandle<()>§stop: Arc<Notify>§state: Arc<HealthState>Implementations§
Source§impl HealthTick
impl HealthTick
Sourcepub fn spawn(registry: Arc<dyn Registry>, interval: Duration) -> Self
pub fn spawn(registry: Arc<dyn Registry>, interval: Duration) -> Self
Starts writing a health line every interval, with its own
HealthState a caller can read back through HealthTick::state.
The first line comes after one interval rather than immediately: at startup the counts are all zero and the banner has just said as much.
A tick that arrives late is delayed rather than replayed. Catching up on missed ticks would print several identical lines in a row after the machine came back from a suspend, which says nothing a single current line does not.
Sourcepub fn state(&self) -> Arc<HealthState> ⓘ
pub fn state(&self) -> Arc<HealthState> ⓘ
The pulse this tick is keeping, for wiring into the HTTP router.
Trait Implementations§
Source§impl Debug for HealthTick
impl Debug for HealthTick
Source§impl Drop for HealthTick
impl Drop for HealthTick
Auto Trait Implementations§
impl Freeze for HealthTick
impl !RefUnwindSafe for HealthTick
impl Send for HealthTick
impl Sync for HealthTick
impl Unpin for HealthTick
impl UnsafeUnpin for HealthTick
impl !UnwindSafe for HealthTick
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more