Skip to content

Commit

Permalink
fix: truncate log for duplicate lightpush/filter message
Browse files Browse the repository at this point in the history
  • Loading branch information
adklempner committed Oct 8, 2024
1 parent 345f248 commit f2d265c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lib/metrics/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ func (g *GenericMetric[T]) Process(ctx context.Context, db *sql.DB, errs *common
return result.Err()
}

var lastInsertId int
err = result.Scan(&lastInsertId)
if err != nil {
return err
}

if err := tx.Commit(); err != nil {
errs.Append(data.ID, fmt.Sprintf("Error committing transaction: %v", err))
return err
Expand Down
5 changes: 5 additions & 0 deletions telemetry/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"log"
"net/http"
"strings"
"time"

"github.com/gorilla/mux"
Expand Down Expand Up @@ -241,6 +242,10 @@ func (s *Server) createWakuTelemetry(w http.ResponseWriter, r *http.Request) {
continue
}
if err := pushFilter.Put(s.DB); err != nil {
if strings.Contains(err.Error(), "duplicate key value violates unique constraint") {
errorDetails.Append(data.Id, "Error saving lightpush/filter metric: Duplicate key value violates unique constraint")
continue
}
errorDetails.Append(data.Id, fmt.Sprintf("Error saving lightpush/filter metric: %v", err))
continue
}
Expand Down

0 comments on commit f2d265c

Please sign in to comment.