Merge branch 'soru/error-handle-to-device-queue' into 'main'

fix: ignore 4xx errors when re-sending the to_device queue

See merge request famedly/company/frontend/famedlysdk!926
This commit is contained in:
Krille Fear 2021-12-09 10:56:29 +00:00
commit 3f225208e2
1 changed files with 7 additions and 1 deletions

View File

@ -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)))));
await super.sendToDevice(entry.type, entry.txnId, data);
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);
}
}