pub enum OverflowStrategy {
Block,
Drop,
Expand,
DropOldest,
Reject,
}Expand description
Strategy for handling overflow when all workers are busy.
This enum defines different strategies for handling situations where all worker threads are occupied and new tasks arrive.
§Examples
use subx_cli::config::OverflowStrategy;
let strategy = OverflowStrategy::Block;
assert_eq!(strategy, OverflowStrategy::Block);
// Comparison and serialization
let strategies = vec![
OverflowStrategy::Block,
OverflowStrategy::Drop,
OverflowStrategy::Expand,
];
assert_eq!(strategies.len(), 3);Variants§
Block
Block until a worker becomes available.
This is the safest option as it ensures all tasks are processed, but may cause the application to become unresponsive.
Drop
Drop new tasks when all workers are busy.
Use this when task loss is acceptable and responsiveness is critical.
Expand
Create additional temporary workers.
This can help with load spikes but may consume excessive resources.
DropOldest
Drop oldest tasks in queue.
Prioritizes recent tasks over older ones in the queue.
Reject
Reject new tasks.
Similar to Drop but may provide error feedback to the caller.
Trait Implementations§
Source§impl Clone for OverflowStrategy
impl Clone for OverflowStrategy
Source§fn clone(&self) -> OverflowStrategy
fn clone(&self) -> OverflowStrategy
Returns a duplicate 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 OverflowStrategy
impl Debug for OverflowStrategy
Source§impl<'de> Deserialize<'de> for OverflowStrategy
impl<'de> Deserialize<'de> for OverflowStrategy
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for OverflowStrategy
impl PartialEq for OverflowStrategy
Source§impl Serialize for OverflowStrategy
impl Serialize for OverflowStrategy
impl StructuralPartialEq for OverflowStrategy
Auto Trait Implementations§
impl Freeze for OverflowStrategy
impl RefUnwindSafe for OverflowStrategy
impl Send for OverflowStrategy
impl Sync for OverflowStrategy
impl Unpin for OverflowStrategy
impl UnwindSafe for OverflowStrategy
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