Fix Windows CI (#467)

* Force chronological message history

* Fix start/end index computation

* Sleep before RPC call

* Lower default max cache sizes on APIs

Co-authored-by: Oskar Thorén <ot@oskarthoren.com>
This commit is contained in:
Hanno Cornelius 2021-04-09 22:47:24 +02:00 committed by GitHub
parent 6a4fcaa671
commit 58dd431779
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 4 deletions

View File

@ -372,6 +372,8 @@ procSuite "Waku v2 JSON-RPC API":
for x in 1..(maxSize + 1):
# Try to cache 1 more than maximum allowed
filters.notify(WakuMessage(payload: @[byte x], contentTopic: defaultContentTopic), requestId)
await sleepAsync(2000.millis)
response = await client.get_waku_v2_filter_v1_messages(defaultContentTopic)
check:

View File

@ -88,6 +88,7 @@ procSuite "Waku Store":
listenSwitch.mount(proto)
await subscriptions.notify("foo", msg)
await sleepAsync(1.millis) # Sleep a millisecond to ensure messages are stored chronologically
await subscriptions.notify("foo", msg2)
var completionFut = newFuture[bool]()
@ -162,6 +163,7 @@ procSuite "Waku Store":
for wakuMsg in msgList:
await subscriptions.notify("foo", wakuMsg)
await sleepAsync(1.millis) # Sleep a millisecond to ensure messages are stored chronologically
var completionFut = newFuture[bool]()
@ -212,6 +214,7 @@ procSuite "Waku Store":
for wakuMsg in msgList:
await subscriptions.notify("foo", wakuMsg)
await sleepAsync(1.millis) # Sleep a millisecond to ensure messages are stored chronologically
var completionFut = newFuture[bool]()
proc handler(response: HistoryResponse) {.gcsafe, closure.} =
@ -262,6 +265,7 @@ procSuite "Waku Store":
for wakuMsg in msgList:
await subscriptions.notify("foo", wakuMsg)
await sleepAsync(1.millis) # Sleep a millisecond to ensure messages are stored chronologically
var completionFut = newFuture[bool]()
proc handler(response: HistoryResponse) {.gcsafe, closure.} =

View File

@ -14,7 +14,7 @@ logScope:
topics = "filter api"
const futTimeout* = 5.seconds # Max time to wait for futures
const maxCache* = 100 # Max number of messages cached per topic @TODO make this configurable
const maxCache* = 30 # Max number of messages cached per topic @TODO make this configurable
proc installFilterApiHandlers*(node: WakuNode, rpcsrv: RpcServer, messageCache: MessageCache) =

View File

@ -15,7 +15,7 @@ logScope:
topics = "relay api"
const futTimeout* = 5.seconds # Max time to wait for futures
const maxCache* = 100 # Max number of messages cached per topic @TODO make this configurable
const maxCache* = 30 # Max number of messages cached per topic @TODO make this configurable
proc installRelayApiHandlers*(node: WakuNode, rpcsrv: RpcServer, topicCache: TopicCache) =

View File

@ -242,9 +242,9 @@ proc paginateWithIndex*(list: seq[IndexedWakuMessage], pinfo: PagingInfo): (seq[
initQuery = true # an empty cursor means it is an initial query
case dir
of PagingDirection.FORWARD:
cursor = list[0].index # perform paging from the begining of the list
cursor = msgList[0].index # perform paging from the begining of the list
of PagingDirection.BACKWARD:
cursor = list[list.len - 1].index # perform paging from the end of the list
cursor = msgList[list.len - 1].index # perform paging from the end of the list
var foundIndexOption = msgList.findIndex(cursor)
# echo "foundIndexOption", foundIndexOption.get()
if foundIndexOption.isNone: # the cursor is not valid