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

send queue: mark ConcurrentRequestFailed as recoverable #3619

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions crates/matrix-sdk/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ pub enum Error {
#[error("a concurrent request failed; see logs for details")]
ConcurrentRequestFailed,

/// An other error was raised
/// this might happen because encryption was enabled on the base-crate
/// An other error was raised.
///
/// This might happen because encryption was enabled on the base-crate
/// but not here and that raised.
#[error("unknown error: {0}")]
UnknownError(Box<dyn std::error::Error + Send + Sync>),
Expand Down
19 changes: 14 additions & 5 deletions crates/matrix-sdk/src/send_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,20 @@ impl RoomSendQueue {
}

Err(err) => {
let is_recoverable = if let crate::Error::Http(ref http_err) = err {
// All transient errors are recoverable.
matches!(http_err.retry_kind(), RetryKind::Transient { .. })
} else {
false
let is_recoverable = match err {
crate::Error::Http(ref http_err) => {
// All transient errors are recoverable.
matches!(http_err.retry_kind(), RetryKind::Transient { .. })
}

// `ConcurrentRequestFailed` typically happens because of an HTTP failure;
// since we don't get the underlying error, be lax and consider it
// recoverable, and let observers decide to retry it or not. At some point
// we'll get the actual underlying error.
crate::Error::ConcurrentRequestFailed => true,

// As of 2024-06-27, all other error types are considered unrecoverable.
_ => false,
};

if is_recoverable {
Expand Down
Loading