use std::time::Duration;
use super::WorkerOptions;
use graphile_worker_recovery::WorkerRecoveryConfig;
impl WorkerOptions {
pub fn worker_recovery(mut self, config: WorkerRecoveryConfig) -> Self {
self.worker_recovery_config = Some(config);
self
}
pub fn heartbeat_interval(mut self, interval: Duration) -> Self {
let mut config = self.worker_recovery_config.unwrap_or_default();
config.heartbeat_interval = interval;
config.enabled = true;
self.worker_recovery_config = Some(config);
self
}
pub fn sweep_interval(mut self, interval: Duration) -> Self {
let mut config = self.worker_recovery_config.unwrap_or_default();
config.sweep_interval = interval;
config.enabled = true;
self.worker_recovery_config = Some(config);
self
}
pub fn sweep_threshold(mut self, threshold: Duration) -> Self {
let mut config = self.worker_recovery_config.unwrap_or_default();
config.sweep_threshold = threshold;
config.enabled = true;
self.worker_recovery_config = Some(config);
self
}
pub fn recovery_delay(mut self, delay: Duration) -> Self {
let mut config = self.worker_recovery_config.unwrap_or_default();
config.recovery_delay = delay;
config.enabled = true;
self.worker_recovery_config = Some(config);
self
}
}