1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-08-15 20:13:16 +02:00

Add websocket delay to prevent joining messages

This commit is contained in:
Ralph Slooten
2024-08-04 17:06:55 +12:00
parent 476843d9f3
commit 22693f727f

View File

@@ -3,6 +3,7 @@ package websockets
import (
"encoding/json"
"time"
"github.com/axllent/mailpit/internal/logger"
)
@@ -83,5 +84,9 @@ func Broadcast(t string, msg interface{}) {
return
}
// add a very small delay to prevent broadcasts from being interpreted
// as a multi-line messages (eg: storage.DeleteMessages() which can send a very quick series)
time.Sleep(time.Millisecond)
go func() { MessageHub.Broadcast <- b }()
}