Struct fang::SleepParams
source · pub struct SleepParams {
pub sleep_period: Duration,
pub max_sleep_period: Duration,
pub min_sleep_period: Duration,
pub sleep_step: Duration,
}
Expand description
Configuration parameters for putting workers to sleep while they don’t have any tasks to execute
Fields§
§sleep_period: Duration
the current sleep period
max_sleep_period: Duration
the maximum period a worker is allowed to sleep.
After this value is reached, sleep_period
is not increased anymore
min_sleep_period: Duration
the initial value of the sleep_period
sleep_step: Duration
the step that sleep_period
is increased by on every iteration
Implementations§
source§impl SleepParams
impl SleepParams
sourcepub fn builder() -> SleepParamsBuilder<((), (), (), ())>
pub fn builder() -> SleepParamsBuilder<((), (), (), ())>
Create a builder for building SleepParams
.
On the builder, call .sleep_period(...)
, .max_sleep_period(...)
, .min_sleep_period(...)
, .sleep_step(...)
to set the values of the fields.
Finally, call .build()
to create the instance of SleepParams
.
source§impl SleepParams
impl SleepParams
sourcepub fn maybe_reset_sleep_period(&mut self)
pub fn maybe_reset_sleep_period(&mut self)
Reset the sleep_period
if sleep_period
> min_sleep_period
sourcepub fn maybe_increase_sleep_period(&mut self)
pub fn maybe_increase_sleep_period(&mut self)
Increase the sleep_period
by the sleep_step
if the max_sleep_period
is not reached
Trait Implementations§
source§impl Clone for SleepParams
impl Clone for SleepParams
source§fn clone(&self) -> SleepParams
fn clone(&self) -> SleepParams
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SleepParams
impl Debug for SleepParams
Auto Trait Implementations§
impl RefUnwindSafe for SleepParams
impl Send for SleepParams
impl Sync for SleepParams
impl Unpin for SleepParams
impl UnwindSafe for SleepParams
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
T: SqlType + TypedExpressionType,
fn into_sql<T>(self) -> Self::Expressionwhere Self: AsExpression<T> + Sized, T: SqlType + TypedExpressionType,
Convert
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,
Convert
&self
to an expression for Diesel’s query builder. Read more