fix(app): ping the relay, retry stuck messages, drop duplicates
A message sent into a dead socket ended up as failed — attachments even stayed on "sending" forever — and only the user could send it again by hand. Mobile NAT drops idle TCP silently, so neither side knew. - pingInterval on the WebSocket, so the client notices a dead link itself - outbox: after every reconnect, stuck messages are re-sent (batch of 30, up to a day old); permanent errors are not retried - sendAttachment gained the try/catch it was missing, otherwise the attachment never reached the outbox - de-duplicate by message id: a retry re-sends the SAME message, which would otherwise show up twice on the other side
This commit is contained in:
@@ -39,10 +39,16 @@ class Conversation {
|
||||
.length;
|
||||
}
|
||||
|
||||
/// Přidej zprávu
|
||||
void addMessage(Message message) {
|
||||
/// Přidej zprávu. Vrací false, když už zpráva s tímhle id v konverzaci je.
|
||||
///
|
||||
/// Id zprávy nese odesílatel (pole `id` na drátě), takže opakované doručení
|
||||
/// téhož obsahu — retry odesílatele po výpadku spojení nebo redelivery
|
||||
/// z fronty relaye — nesmí založit druhou bublinu.
|
||||
bool addMessage(Message message) {
|
||||
if (messages.any((m) => m.id == message.id)) return false;
|
||||
messages.add(message);
|
||||
lastActivity = DateTime.now();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Nahraď zprávu se stejným id (změna stavu přílohy, doručenka…).
|
||||
|
||||
Reference in New Issue
Block a user