Skip to content

Commit 17d1832

Browse files
committed
send queue: mark ConcurrentRequestFailed as recoverable
This will still disable the room's send queue, but the embedder may then decide whether to re-enable the queue or not, based on network connectivity. Ideally, we'd implement some retry mechanism here too, but since we're at a different layer than the HTTP one, we can't get that "for free", so let the embedder decide what to do here.
1 parent 374da76 commit 17d1832

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

crates/matrix-sdk/src/error.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,9 @@ pub enum Error {
320320
#[error("a concurrent request failed; see logs for details")]
321321
ConcurrentRequestFailed,
322322

323-
/// An other error was raised
324-
/// this might happen because encryption was enabled on the base-crate
323+
/// An other error was raised.
324+
///
325+
/// This might happen because encryption was enabled on the base-crate
325326
/// but not here and that raised.
326327
#[error("unknown error: {0}")]
327328
UnknownError(Box<dyn std::error::Error + Send + Sync>),

crates/matrix-sdk/src/send_queue.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,20 @@ impl RoomSendQueue {
468468
}
469469

470470
Err(err) => {
471-
let is_recoverable = if let crate::Error::Http(ref http_err) = err {
472-
// All transient errors are recoverable.
473-
matches!(http_err.retry_kind(), RetryKind::Transient { .. })
474-
} else {
475-
false
471+
let is_recoverable = match err {
472+
crate::Error::Http(ref http_err) => {
473+
// All transient errors are recoverable.
474+
matches!(http_err.retry_kind(), RetryKind::Transient { .. })
475+
}
476+
477+
// `ConcurrentRequestFailed` typically happens because of an HTTP failure;
478+
// since we don't get the underlying error, be lax and consider it
479+
// recoverable, and let observers decide to retry it or not. At some point
480+
// we'll get the actual underlying error.
481+
crate::Error::ConcurrentRequestFailed => true,
482+
483+
// As of 2024-06-27, all other error types are considered unrecoverable.
484+
_ => false,
476485
};
477486

478487
if is_recoverable {

0 commit comments

Comments
 (0)