feat(backend/ender): remove from memory sessions with wrong duration

This commit is contained in:
Alexander Zavorotynskiy 2022-11-30 17:44:35 +01:00
parent a7c9fda307
commit 2dc8af998c

View file

@ -5,6 +5,7 @@ import (
"openreplay/backend/internal/storage"
"os"
"os/signal"
"strings"
"syscall"
"time"
@ -72,6 +73,10 @@ func main() {
newDuration, err := pg.InsertSessionEnd(sessionID, msg.Timestamp)
if err != nil {
log.Printf("can't save sessionEnd to database, sessID: %d, err: %s", sessionID, err)
if strings.Contains(err.Error(), "integer out of range") {
// Skip message with broken duration
return true
}
return false
}
if currDuration == newDuration {