mirror of
https://github.com/waku-org/nwaku.git
synced 2025-02-28 23:10:54 +00:00
fix: sqlite limited delete query bug (#2111)
This commit is contained in:
parent
a0033dff52
commit
06bc433a80
@ -181,9 +181,9 @@ proc deleteMessagesOlderThanTimestamp*(db: SqliteDatabase, ts: int64):
|
|||||||
## Delete oldest messages not within limit
|
## Delete oldest messages not within limit
|
||||||
|
|
||||||
proc deleteOldestMessagesNotWithinLimitQuery(table: string, limit: int): SqlQueryStr =
|
proc deleteOldestMessagesNotWithinLimitQuery(table: string, limit: int): SqlQueryStr =
|
||||||
"DELETE FROM " & table & " WHERE id NOT IN (" &
|
"DELETE FROM " & table & " WHERE (storedAt, id, pubsubTopic) NOT IN (" &
|
||||||
" SELECT id FROM " & table &
|
" SELECT storedAt, id, pubsubTopic FROM " & table &
|
||||||
" ORDER BY storedAt DESC" &
|
" ORDER BY storedAt DESC, id DESC" &
|
||||||
" LIMIT " & $limit &
|
" LIMIT " & $limit &
|
||||||
");"
|
");"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user