mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-03 06:03:06 +00:00
test query
This commit is contained in:
parent
b746a266e7
commit
70b5956773
@ -320,6 +320,9 @@ method query*(
|
||||
lock = newAsyncLock() # serialize querying under threads
|
||||
iter = QueryIter.new()
|
||||
|
||||
echo "query:first:iter:dispatch"
|
||||
await nextSignal.fire()
|
||||
|
||||
echo "query:next:ready: "
|
||||
|
||||
proc next(): Future[?!QueryResponse] {.async.} =
|
||||
@ -337,19 +340,16 @@ method query*(
|
||||
echo "query:next:iter:finished"
|
||||
return failure (ref QueryEndedError)(msg: "Calling next on a finished query!")
|
||||
|
||||
if not ctx[].running:
|
||||
echo "query:next:iter:finished "
|
||||
iter.finished = true
|
||||
return
|
||||
|
||||
echo "query:next:acquire:lock"
|
||||
await lock.acquire()
|
||||
|
||||
echo "query:next:iter:dispatch"
|
||||
await nextSignal.fire()
|
||||
echo "query:next:iter:dispatch:wait"
|
||||
await wait(ctx[].signal)
|
||||
|
||||
if not ctx[].running:
|
||||
echo "query:next:iter:finished "
|
||||
iter.finished = true
|
||||
# return
|
||||
|
||||
echo "query:next:iter:res: ", ctx[].res, "\n"
|
||||
|
||||
if ctx[].res.isErr():
|
||||
@ -360,6 +360,9 @@ method query*(
|
||||
let data = qres.data.toSeq()
|
||||
return (?!QueryResponse).ok((key: key, data: data))
|
||||
|
||||
echo "query:next:iter:dispatch"
|
||||
await nextSignal.fire()
|
||||
|
||||
iter.next = next
|
||||
return success iter
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user