mirror of
https://github.com/aljazceru/meshcore-web.git
synced 2025-12-18 00:24:21 +01:00
force user to wait 1 second before sending another message
This commit is contained in:
@@ -175,13 +175,8 @@ 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
|
||||
await Database.Message.insert({
|
||||
const databaseMessage = await Database.Message.insert({
|
||||
status: "sending",
|
||||
to: publicKey,
|
||||
from: GlobalState.selfInfo.publicKey,
|
||||
@@ -195,6 +190,11 @@ class Connection {
|
||||
error: null,
|
||||
});
|
||||
|
||||
// mark message as failed after estimated timeout
|
||||
setTimeout(async () => {
|
||||
await Database.Message.setMessageFailedById(databaseMessage.id, "timeout");
|
||||
}, message.estTimeout);
|
||||
|
||||
}
|
||||
|
||||
static async syncMessages() {
|
||||
|
||||
Reference in New Issue
Block a user