pub struct DaemonConfig {Show 23 fields
pub claim_batch_size: usize,
pub default_model_concurrency: usize,
pub model_concurrency_limits: Arc<DashMap<String, usize>>,
pub model_escalations: Arc<DashMap<String, ModelEscalationConfig>>,
pub claim_interval_ms: u64,
pub max_retries: Option<u32>,
pub stop_before_deadline_ms: Option<i64>,
pub backoff_ms: u64,
pub backoff_factor: u64,
pub max_backoff_ms: u64,
pub timeout_ms: u64,
pub status_log_interval_ms: Option<u64>,
pub heartbeat_interval_ms: u64,
pub should_retry: ShouldRetryFn,
pub claim_timeout_ms: u64,
pub processing_timeout_ms: u64,
pub stale_daemon_threshold_ms: u64,
pub unclaim_batch_size: usize,
pub cancellation_poll_interval_ms: u64,
pub batch_metadata_fields: Vec<String>,
pub purge_interval_ms: u64,
pub purge_batch_size: i64,
pub purge_throttle_ms: u64,
}Expand description
Configuration for the daemon.
Fields§
§claim_batch_size: usizeMaximum number of requests to claim in each iteration
default_model_concurrency: usizeDefault concurrency limit per model
model_concurrency_limits: Arc<DashMap<String, usize>>Per-model concurrency overrides (shared, can be updated dynamically)
model_escalations: Arc<DashMap<String, ModelEscalationConfig>>Per-model escalation configurations for SLA-based model switching Maps model name -> escalation config (e.g., “gpt-4” -> “o1-preview”) When a request is escalated, it’s routed to the escalation_model by the control layer
claim_interval_ms: u64How long to sleep between claim iterations
max_retries: Option<u32>Maximum number of retry attempts before giving up.
stop_before_deadline_ms: Option<i64>Stop retrying (including escalations) this many milliseconds before the batch expires.
- Negative (e.g., -300000 = -5 min): Retry for a buffer window AFTER SLA deadline (recommended)
- Zero: Stop exactly at SLA deadline
- Positive: Stop BEFORE SLA deadline (terminates retryable errors within the SLA deadline, avoid!)
- None: No deadline awareness
Default: 0 (stop retrying/escalating on SLA deadline)
backoff_ms: u64Base backoff duration in milliseconds (will be exponentially increased)
backoff_factor: u64Factor by which the backoff_ms is increased with each retry
max_backoff_ms: u64Maximum backoff time in milliseconds
timeout_ms: u64Timeout for each individual request attempt in milliseconds
status_log_interval_ms: Option<u64>Interval for logging daemon status (requests in flight) in milliseconds Set to None to disable periodic status logging
heartbeat_interval_ms: u64Interval for sending heartbeats to update daemon status in database (milliseconds)
should_retry: ShouldRetryFnPredicate function to determine if a response should be retried. Defaults to retrying 5xx, 429, 408, and 404 status codes.
claim_timeout_ms: u64Maximum time a request can stay in “claimed” state before being unclaimed and returned to pending (milliseconds). This handles daemon crashes.
processing_timeout_ms: u64Maximum time a request can stay in “processing” state before being unclaimed and returned to pending (milliseconds). This handles daemon crashes during execution.
stale_daemon_threshold_ms: u64Time after a daemon’s last heartbeat before its requests are considered
orphaned and returned to pending (milliseconds). Should be significantly
larger than heartbeat_interval_ms to avoid reclaiming from live daemons
that are merely slow. Also reclaims from daemons explicitly marked dead.
Default: 30,000 (30 seconds, 6× the default heartbeat interval).
unclaim_batch_size: usizeMaximum number of stale requests to unclaim in a single poll cycle. Limits database load when many requests become stale simultaneously (e.g., daemon crash).
cancellation_poll_interval_ms: u64Interval for polling batches to perform finalization and check for cancellations (milliseconds).
This polling loop serves two purposes:
- Batch Finalization: Fetches active batches and triggers lazy finalization (computing completion timestamps when all requests reach terminal states)
- Cancellation Detection: Checks if any active batches have been cancelled and aborts their in-flight requests
Default: 5000ms (5 seconds)
batch_metadata_fields: Vec<String>Batch table column names to include as request headers.
These values are sent as x-fusillade-batch-{column} headers with each request.
Example: [“id”, “created_by”, “endpoint”] produces headers like:
- x-fusillade-batch-id
- x-fusillade-batch-created-by
- x-fusillade-batch-endpoint
purge_interval_ms: u64Interval for running the orphaned row purge task (milliseconds). Deletes orphaned request_templates and requests whose parent file/batch has been soft-deleted, for right-to-erasure compliance. Set to 0 to disable purging. Default: 3,600,000 (1 hour).
purge_batch_size: i64Maximum number of orphaned rows to delete per purge iteration. Each iteration deletes up to this many requests and this many request_templates. Default: 1000.
purge_throttle_ms: u64Throttle delay between consecutive purge batches within a single drain cycle (milliseconds). Prevents sustained high DB load when many orphans exist. Default: 100.
Trait Implementations§
Source§impl Clone for DaemonConfig
impl Clone for DaemonConfig
Source§fn clone(&self) -> DaemonConfig
fn clone(&self) -> DaemonConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for DaemonConfig
impl Default for DaemonConfig
Source§impl<'de> Deserialize<'de> for DaemonConfig
impl<'de> Deserialize<'de> for DaemonConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&DaemonConfig> for RetryConfig
impl From<&DaemonConfig> for RetryConfig
Source§fn from(config: &DaemonConfig) -> Self
fn from(config: &DaemonConfig) -> Self
Auto Trait Implementations§
impl Freeze for DaemonConfig
impl !RefUnwindSafe for DaemonConfig
impl Send for DaemonConfig
impl Sync for DaemonConfig
impl Unpin for DaemonConfig
impl UnsafeUnpin for DaemonConfig
impl !UnwindSafe for DaemonConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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