Skip to content

Commit

Permalink
docs(sinks): improve documentation of RetryLogic trait functions (#…
Browse files Browse the repository at this point in the history
…19617)

* docs(sinks): improve documentation of RetryLogic trait functions

* i can spel
  • Loading branch information
neuronull authored Jan 12, 2024
1 parent f262324 commit 131ab45
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sinks/util/retries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ pub trait RetryLogic: Clone + Send + Sync + 'static {
type Error: std::error::Error + Send + Sync + 'static;
type Response;

/// When the Service call returns an `Err` response, this function allows
/// implementors to specify what kinds of errors can be retried.
fn is_retriable_error(&self, error: &Self::Error) -> bool;

/// When the Service call returns an `Ok` response, this function allows
/// implementors to specify additional logic to determine if the success response
/// is actually an error. This is particularly useful when the downstream service
/// of a sink returns a transport protocol layer success but error data in the
/// response body. For example, an HTTP 200 status, but the body of the response
/// contains a list of errors encountered while processing.
fn should_retry_response(&self, _response: &Self::Response) -> RetryAction {
// Treat the default as the request is successful
RetryAction::Successful
Expand Down

0 comments on commit 131ab45

Please sign in to comment.