mirror of
https://github.com/status-im/go-waku.git
synced 2025-02-10 04:35:06 +00:00
fix: limit can't be negative for postgres
This commit is contained in:
parent
2f9f304762
commit
d268b2e403
@ -224,7 +224,7 @@ func (d *DBStore) cleanOlderRecords(ctx context.Context) error {
|
|||||||
// Limit number of records to a max N
|
// Limit number of records to a max N
|
||||||
if d.maxMessages > 0 {
|
if d.maxMessages > 0 {
|
||||||
start := time.Now()
|
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)
|
_, err := d.db.Exec(sqlStmt, d.maxMessages)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
d.metrics.RecordError(retPolicyFailure)
|
d.metrics.RecordError(retPolicyFailure)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user