Skip to content

Commit

Permalink
fix: limit can't be negative for postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-98 committed Sep 21, 2023
1 parent 49ad109 commit c01ca92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion waku/persistence/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (d *DBStore) cleanOlderRecords(ctx context.Context) error {
// Limit number of records to a max N
if d.maxMessages > 0 {
start := time.Now()
sqlStmt := `DELETE FROM message WHERE id IN (SELECT id FROM message ORDER BY receiverTimestamp DESC LIMIT -1 OFFSET $1)`
sqlStmt := `DELETE FROM message WHERE id IN (SELECT id FROM message ORDER BY receiverTimestamp DESC OFFSET $1)`
_, err := d.db.Exec(sqlStmt, d.maxMessages)
if err != nil {
d.metrics.RecordError(retPolicyFailure)
Expand Down

0 comments on commit c01ca92

Please sign in to comment.