pub struct RunnableRetry { /* private fields */ }Expand description
A runnable that retries an inner runnable on matching errors.
Uses exponential backoff with optional jitter. Only errors whose
SynwireErrorKind appears in the retry_on list are retried;
all other errors propagate immediately.
Implementations§
Source§impl RunnableRetry
impl RunnableRetry
Sourcepub fn new(inner: Box<dyn RunnableCore>, config: RetryConfig) -> Self
pub fn new(inner: Box<dyn RunnableCore>, config: RetryConfig) -> Self
Wrap a runnable with retry behaviour.
Trait Implementations§
Source§impl RunnableCore for RunnableRetry
impl RunnableCore for RunnableRetry
Source§fn invoke<'a>(
&'a self,
input: Value,
config: Option<&'a RunnableConfig>,
) -> BoxFuture<'a, Result<Value, SynwireError>>
fn invoke<'a>( &'a self, input: Value, config: Option<&'a RunnableConfig>, ) -> BoxFuture<'a, Result<Value, SynwireError>>
Invoke the runnable with a single input.
Source§fn batch<'a>(
&'a self,
inputs: Vec<Value>,
config: Option<&'a RunnableConfig>,
) -> BoxFuture<'a, Result<Vec<Value>, SynwireError>>
fn batch<'a>( &'a self, inputs: Vec<Value>, config: Option<&'a RunnableConfig>, ) -> BoxFuture<'a, Result<Vec<Value>, SynwireError>>
Invoke on multiple inputs. Default implementation calls
invoke sequentially for each input.Source§fn stream<'a>(
&'a self,
input: Value,
config: Option<&'a RunnableConfig>,
) -> BoxFuture<'a, Result<BoxStream<'a, Result<Value, SynwireError>>, SynwireError>>
fn stream<'a>( &'a self, input: Value, config: Option<&'a RunnableConfig>, ) -> BoxFuture<'a, Result<BoxStream<'a, Result<Value, SynwireError>>, SynwireError>>
Stream results. Default implementation wraps
invoke
as a single-item stream.Auto Trait Implementations§
impl Freeze for RunnableRetry
impl !RefUnwindSafe for RunnableRetry
impl Send for RunnableRetry
impl Sync for RunnableRetry
impl Unpin for RunnableRetry
impl UnsafeUnpin for RunnableRetry
impl !UnwindSafe for RunnableRetry
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