Report correct number of pruned rows in Postgres mailserver (#1789)

This commit is contained in:
Adam Babik 2020-01-13 21:13:28 +01:00 committed by GitHub
parent 44aa313981
commit 179e3e851e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -171,11 +171,15 @@ func (i *PostgresDB) Prune(t time.Time, batch int) (int, error) {
} }
defer stmt.Close() defer stmt.Close()
if _, err = stmt.Exec(kl.Bytes(), ku.Bytes()); err != nil { result, err := stmt.Exec(kl.Bytes(), ku.Bytes())
if err != nil {
return 0, err return 0, err
} }
rows, err := result.RowsAffected()
return 0, nil if err != nil {
return 0, err
}
return int(rows), nil
} }
func (i *PostgresDB) SaveEnvelope(env types.Envelope) error { func (i *PostgresDB) SaveEnvelope(env types.Envelope) error {