mirror of https://github.com/waku-org/nwaku.git
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:
parent
6a4fcaa671
commit
58dd431779
|
@ -372,6 +372,8 @@ procSuite "Waku v2 JSON-RPC API":
|
||||||
for x in 1..(maxSize + 1):
|
for x in 1..(maxSize + 1):
|
||||||
# Try to cache 1 more than maximum allowed
|
# Try to cache 1 more than maximum allowed
|
||||||
filters.notify(WakuMessage(payload: @[byte x], contentTopic: defaultContentTopic), requestId)
|
filters.notify(WakuMessage(payload: @[byte x], contentTopic: defaultContentTopic), requestId)
|
||||||
|
|
||||||
|
await sleepAsync(2000.millis)
|
||||||
|
|
||||||
response = await client.get_waku_v2_filter_v1_messages(defaultContentTopic)
|
response = await client.get_waku_v2_filter_v1_messages(defaultContentTopic)
|
||||||
check:
|
check:
|
||||||
|
|
|
@ -88,6 +88,7 @@ procSuite "Waku Store":
|
||||||
listenSwitch.mount(proto)
|
listenSwitch.mount(proto)
|
||||||
|
|
||||||
await subscriptions.notify("foo", msg)
|
await subscriptions.notify("foo", msg)
|
||||||
|
await sleepAsync(1.millis) # Sleep a millisecond to ensure messages are stored chronologically
|
||||||
await subscriptions.notify("foo", msg2)
|
await subscriptions.notify("foo", msg2)
|
||||||
|
|
||||||
var completionFut = newFuture[bool]()
|
var completionFut = newFuture[bool]()
|
||||||
|
@ -162,6 +163,7 @@ procSuite "Waku Store":
|
||||||
|
|
||||||
for wakuMsg in msgList:
|
for wakuMsg in msgList:
|
||||||
await subscriptions.notify("foo", wakuMsg)
|
await subscriptions.notify("foo", wakuMsg)
|
||||||
|
await sleepAsync(1.millis) # Sleep a millisecond to ensure messages are stored chronologically
|
||||||
|
|
||||||
var completionFut = newFuture[bool]()
|
var completionFut = newFuture[bool]()
|
||||||
|
|
||||||
|
@ -212,6 +214,7 @@ procSuite "Waku Store":
|
||||||
|
|
||||||
for wakuMsg in msgList:
|
for wakuMsg in msgList:
|
||||||
await subscriptions.notify("foo", wakuMsg)
|
await subscriptions.notify("foo", wakuMsg)
|
||||||
|
await sleepAsync(1.millis) # Sleep a millisecond to ensure messages are stored chronologically
|
||||||
var completionFut = newFuture[bool]()
|
var completionFut = newFuture[bool]()
|
||||||
|
|
||||||
proc handler(response: HistoryResponse) {.gcsafe, closure.} =
|
proc handler(response: HistoryResponse) {.gcsafe, closure.} =
|
||||||
|
@ -262,6 +265,7 @@ procSuite "Waku Store":
|
||||||
|
|
||||||
for wakuMsg in msgList:
|
for wakuMsg in msgList:
|
||||||
await subscriptions.notify("foo", wakuMsg)
|
await subscriptions.notify("foo", wakuMsg)
|
||||||
|
await sleepAsync(1.millis) # Sleep a millisecond to ensure messages are stored chronologically
|
||||||
var completionFut = newFuture[bool]()
|
var completionFut = newFuture[bool]()
|
||||||
|
|
||||||
proc handler(response: HistoryResponse) {.gcsafe, closure.} =
|
proc handler(response: HistoryResponse) {.gcsafe, closure.} =
|
||||||
|
|
|
@ -14,7 +14,7 @@ logScope:
|
||||||
topics = "filter api"
|
topics = "filter api"
|
||||||
|
|
||||||
const futTimeout* = 5.seconds # Max time to wait for futures
|
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) =
|
proc installFilterApiHandlers*(node: WakuNode, rpcsrv: RpcServer, messageCache: MessageCache) =
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ logScope:
|
||||||
topics = "relay api"
|
topics = "relay api"
|
||||||
|
|
||||||
const futTimeout* = 5.seconds # Max time to wait for futures
|
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) =
|
proc installRelayApiHandlers*(node: WakuNode, rpcsrv: RpcServer, topicCache: TopicCache) =
|
||||||
|
|
||||||
|
|
|
@ -242,9 +242,9 @@ proc paginateWithIndex*(list: seq[IndexedWakuMessage], pinfo: PagingInfo): (seq[
|
||||||
initQuery = true # an empty cursor means it is an initial query
|
initQuery = true # an empty cursor means it is an initial query
|
||||||
case dir
|
case dir
|
||||||
of PagingDirection.FORWARD:
|
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:
|
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)
|
var foundIndexOption = msgList.findIndex(cursor)
|
||||||
# echo "foundIndexOption", foundIndexOption.get()
|
# echo "foundIndexOption", foundIndexOption.get()
|
||||||
if foundIndexOption.isNone: # the cursor is not valid
|
if foundIndexOption.isNone: # the cursor is not valid
|
||||||
|
|
Loading…
Reference in New Issue