fix: ignore 4xx errors when re-sending the to_device queue
The to_device queue was introduced to ensure integrity if e.g. the server temporarily failed when attempting to send a to_device message. If, for whatever reason, the server responds with a 4xx error, though, then we want to ignore that to_device message from the queue and move on, as that means that something different was fundamentally wrong. This helps to fix the to_device queue clogging up, making clients incapable of sending to_device events anymore, should such clogging happen.
This commit is contained in:
parent
8f877b2039
commit
fa5abfca92
|
|
@ -2055,7 +2055,13 @@ class Client extends MatrixApi {
|
|||
(v as Map).map((k, v) => MapEntry<String, Map<String, dynamic>>(
|
||||
k, Map<String, dynamic>.from(v)))));
|
||||
|
||||
try {
|
||||
await super.sendToDevice(entry.type, entry.txnId, data);
|
||||
} on MatrixException catch (e) {
|
||||
Logs().w(
|
||||
'[To-Device] failed to to_device message from the queue to the server. Ignoring error: $e');
|
||||
Logs().w('Payload: $data');
|
||||
}
|
||||
await database.deleteFromToDeviceQueue(entry.id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue