Struct apalis_core::monitor::Monitor
source · pub struct Monitor<E> { /* private fields */ }Expand description
A monitor for coordinating and managing a collection of workers.
Implementations§
source§impl<E: Executor + Send + Sync + 'static> Monitor<E>
impl<E: Executor + Send + Sync + 'static> Monitor<E>
sourcepub fn register<Strm, Serv: Service<JobRequest<J>>, J: Job + 'static, W: Worker<J, Service = Serv, Source = Strm> + 'static>(
self,
worker: W
) -> Selfwhere
<Serv as Service<JobRequest<J>>>::Future: Send,
pub fn register<Strm, Serv: Service<JobRequest<J>>, J: Job + 'static, W: Worker<J, Service = Serv, Source = Strm> + 'static>( self, worker: W ) -> Selfwhere <Serv as Service<JobRequest<J>>>::Future: Send,
sourcepub fn register_with_count<Strm, Serv: Service<JobRequest<J>>, J: Job + 'static, W: Worker<J, Service = Serv, Source = Strm> + 'static, Call: Fn(u16) -> W>(
self,
count: u16,
caller: Call
) -> Selfwhere
<Serv as Service<JobRequest<J>>>::Future: Send,
pub fn register_with_count<Strm, Serv: Service<JobRequest<J>>, J: Job + 'static, W: Worker<J, Service = Serv, Source = Strm> + 'static, Call: Fn(u16) -> W>( self, count: u16, caller: Call ) -> Selfwhere <Serv as Service<JobRequest<J>>>::Future: Send,
sourcepub fn shutdown_timeout(self, duration: Duration) -> Self
pub fn shutdown_timeout(self, duration: Duration) -> Self
sourcepub async fn run(self) -> Result<()>
pub async fn run(self) -> Result<()>
Runs the monitor and all its registered workers until they have all completed.
Errors
If the monitor fails to shutdown gracefully, an std::io::Error will be returned.
Remarks
If a timeout has been set using the shutdown_timeout method, the monitor
will wait for all workers to complete up to the timeout duration before exiting.
If the timeout is reached and workers have not completed, the monitor will log a warning
message and exit forcefully.
Trait Implementations§
Auto Trait Implementations§
impl<E> RefUnwindSafe for Monitor<E>where E: RefUnwindSafe,
impl<E> Send for Monitor<E>where E: Send,
impl<E> Sync for Monitor<E>where E: Sync,
impl<E> Unpin for Monitor<E>where E: Unpin,
impl<E> UnwindSafe for Monitor<E>where E: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more