chore: archive.nim - increase the max limit of content topics per query to 100 (#2846)

This commit is contained in:
Ivan FB 2024-06-26 12:24:15 +02:00 committed by GitHub
parent 99149ea9dc
commit a05fa06919
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -233,13 +233,13 @@ procSuite "Waku Archive - find messages":
response.messages.anyIt(it == msg1) response.messages.anyIt(it == msg1)
response.messages.anyIt(it == msg3) response.messages.anyIt(it == msg3)
test "handle query with more than 10 content filters": test "handle query with more than 100 content filters":
## Setup ## Setup
let let
driver = newSqliteArchiveDriver() driver = newSqliteArchiveDriver()
archive = newWakuArchive(driver) archive = newWakuArchive(driver)
let queryTopics = toSeq(1 .. 15).mapIt(ContentTopic($it)) let queryTopics = toSeq(1 .. 150).mapIt(ContentTopic($it))
## Given ## Given
let req = ArchiveQuery(contentTopics: queryTopics) let req = ArchiveQuery(contentTopics: queryTopics)

View File

@ -141,7 +141,7 @@ proc findMessages*(
let isAscendingOrder = query.direction.into() let isAscendingOrder = query.direction.into()
if query.contentTopics.len > 10: if query.contentTopics.len > 100:
return err(ArchiveError.invalidQuery("too many content topics")) return err(ArchiveError.invalidQuery("too many content topics"))
if query.cursor.isSome() and query.cursor.get().hash.len != 32: if query.cursor.isSome() and query.cursor.get().hash.len != 32:
@ -229,7 +229,7 @@ proc findMessagesV2*(
let isAscendingOrder = query.direction.into() let isAscendingOrder = query.direction.into()
if query.contentTopics.len > 10: if query.contentTopics.len > 100:
return err(ArchiveError.invalidQuery("too many content topics")) return err(ArchiveError.invalidQuery("too many content topics"))
let queryStartTime = getTime().toUnixFloat() let queryStartTime = getTime().toUnixFloat()