Use NULL-tolerant comparison for DeliveryReceipts
Since NULL = NULL is always FALSE, this query needs to use IS instead. This should fix the flood of DeliveryReceipts in the DB. See https://www.sqlite.org/lang_expr.html > The IS and IS NOT operators work like = and != except when one or both > of the operands are NULL. In this case, if both operands are NULL, > then the IS operator evaluates to 1 (true) and the IS NOT operator > evaluates to 0 (false). If one operand is NULL and the other is not, > then the IS operator evaluates to 0 (false) and the IS NOT operator is > 1 (true). It is not possible for an IS or IS NOT expression to > evaluate to NULL.
This commit is contained in:
parent
4dce5a91c9
commit
bc83d3a3ba
@ -542,7 +542,7 @@ func (db *SqliteDB) StoreClientDeliveryReceipts(networkID int64, client string,
|
||||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
_, err = tx.Exec("DELETE FROM DeliveryReceipt WHERE network = ? AND client = ?",
|
||||
_, err = tx.Exec("DELETE FROM DeliveryReceipt WHERE network = ? AND client IS ?",
|
||||
networkID, toNullString(client))
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user