pub struct MaintenanceService { /* private fields */ }Expand description
Maintenance service: runs leader-elected background tasks.
Tasks: heartbeat rescue, deadline rescue, scheduled promotion, cleanup, periodic job sync and evaluation.
Implementations§
Source§impl MaintenanceService
impl MaintenanceService
Sourcepub fn leader_election_interval(self, interval: Duration) -> Self
pub fn leader_election_interval(self, interval: Duration) -> Self
Set the leader election retry interval (default: 10s).
Controls how often a non-leader instance retries acquiring the advisory lock. Lower values speed up leader election in tests.
Sourcepub fn leader_check_interval(self, interval: Duration) -> Self
pub fn leader_check_interval(self, interval: Duration) -> Self
Set the leader connection health-check interval (default: 30s).
Sourcepub fn promote_interval(self, interval: Duration) -> Self
pub fn promote_interval(self, interval: Duration) -> Self
Set the promotion interval for scheduled/retryable jobs.
Sourcepub fn heartbeat_rescue_interval(self, interval: Duration) -> Self
pub fn heartbeat_rescue_interval(self, interval: Duration) -> Self
Set the stale-heartbeat rescue interval (default: 30s).
Sourcepub fn deadline_rescue_interval(self, interval: Duration) -> Self
pub fn deadline_rescue_interval(self, interval: Duration) -> Self
Set the deadline rescue interval (default: 30s).
Sourcepub fn callback_rescue_interval(self, interval: Duration) -> Self
pub fn callback_rescue_interval(self, interval: Duration) -> Self
Set the callback-timeout rescue interval (default: 30s).
Sourcepub fn heartbeat_staleness(self, staleness: Duration) -> Self
pub fn heartbeat_staleness(self, staleness: Duration) -> Self
Set how long a heartbeat must be stale before the job is rescued (default: 90s).
Should be at least 3× the heartbeat interval to avoid false rescues from transient delays. The run-lease guard prevents duplicate completions even if a false rescue occurs, but wasted work is still undesirable.
Sourcepub fn cleanup_interval(self, interval: Duration) -> Self
pub fn cleanup_interval(self, interval: Duration) -> Self
Set the cleanup interval (default: 60s).
Sourcepub fn completed_retention(self, retention: Duration) -> Self
pub fn completed_retention(self, retention: Duration) -> Self
Set retention for completed jobs (default: 24h).
Sourcepub fn failed_retention(self, retention: Duration) -> Self
pub fn failed_retention(self, retention: Duration) -> Self
Set retention for failed/cancelled jobs (default: 72h).
Sourcepub fn cleanup_batch_size(self, batch_size: i64) -> Self
pub fn cleanup_batch_size(self, batch_size: i64) -> Self
Set the maximum number of jobs to delete per cleanup pass (default: 1000).
Sourcepub fn queue_stats_interval(self, interval: Duration) -> Self
pub fn queue_stats_interval(self, interval: Duration) -> Self
Set the interval for publishing queue depth/lag metrics (default: 30s).
Sourcepub fn queue_retention_overrides(
self,
overrides: HashMap<String, RetentionPolicy>,
) -> Self
pub fn queue_retention_overrides( self, overrides: HashMap<String, RetentionPolicy>, ) -> Self
Set per-queue retention overrides.
Auto Trait Implementations§
impl Freeze for MaintenanceService
impl !RefUnwindSafe for MaintenanceService
impl Send for MaintenanceService
impl Sync for MaintenanceService
impl Unpin for MaintenanceService
impl UnsafeUnpin for MaintenanceService
impl !UnwindSafe for MaintenanceService
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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