mark messages as failed if they timeout

This commit is contained in:
liamcottle
2025-02-13 16:16:00 +13:00
parent e4ba9b6609
commit b62f45d150
3 changed files with 45 additions and 4 deletions

View File

@@ -175,8 +175,13 @@ class Connection {
// send message
const message = await GlobalState.connection.sendTextMessage(publicKey, text);
// mark message as failed after estimated timeout
setTimeout(async () => {
await Database.Message.setMessageFailedByAckCode(message.expectedAckCrc, "timeout");
}, message.estTimeout);
// save to database
return await Database.Message.insert({
await Database.Message.insert({
status: "sending",
to: publicKey,
from: GlobalState.selfInfo.publicKey,