Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(sinks): improve documentation of RetryLogic trait functions #19617

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
type Error: std::error::Error + Send + Sync + 'static;
type Response;

/// When the Service call returns an `Err` respoonse, this function allows
Fixed Show fixed Hide fixed
/// 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` resppnse, this function allows
Fixed Show fixed Hide fixed
/// 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
Loading