Don't try to upsert zero records

main
Max Ignatenko 2024-03-20 13:30:51 +00:00
parent 542be03088
commit bae23a62d0
1 changed files with 1 additions and 1 deletions

View File

@ -338,7 +338,7 @@ func (c *Consumer) processMessage(ctx context.Context, typ string, r io.Reader,
if len(recs) == 0 && expectRecords { if len(recs) == 0 && expectRecords {
log.Debug().Int64("seq", payload.Seq).Str("pds", c.remote.Host).Msgf("len(recs) == 0") log.Debug().Int64("seq", payload.Seq).Str("pds", c.remote.Host).Msgf("len(recs) == 0")
} }
if len(recs) > 0 || expectRecords { if len(recs) > 0 {
err = c.db.Model(&repo.Record{}). err = c.db.Model(&repo.Record{}).
Clauses(clause.OnConflict{ Clauses(clause.OnConflict{
Where: clause.Where{Exprs: []clause.Expression{clause.Or( Where: clause.Where{Exprs: []clause.Expression{clause.Or(