mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-03 06:03:06 +00:00
add nextSignal using mutex
This commit is contained in:
parent
3cc21b3a59
commit
1da59ba730
@ -131,6 +131,7 @@ template dispatchTask[BT](self: ThreadDatastore[BT],
|
||||
ctx.setCancelled()
|
||||
raise exc
|
||||
finally:
|
||||
echo "signal:CLOSE!"
|
||||
discard ctx[].signal.close()
|
||||
self.semaphore.release()
|
||||
|
||||
@ -333,6 +334,7 @@ method query*[BT](self: ThreadDatastore[BT],
|
||||
except CancelledError as exc:
|
||||
trace "Cancelling thread future!", exc = exc.msg
|
||||
ctx.setCancelled()
|
||||
echo "signal:CLOSE!"
|
||||
discard ctx[].signal.close()
|
||||
echo "nextSignal:CLOSE!"
|
||||
ctx[].nextSignal.close()
|
||||
@ -343,6 +345,7 @@ method query*[BT](self: ThreadDatastore[BT],
|
||||
return success iter
|
||||
except CancelledError as exc:
|
||||
trace "Cancelling thread future!", exc = exc.msg
|
||||
echo "signal:CLOSE!"
|
||||
discard signal.close()
|
||||
echo "nextSignal:CLOSE!"
|
||||
ctx[].nextSignal.close()
|
||||
|
||||
@ -24,8 +24,10 @@ import ./querycommontests
|
||||
|
||||
const
|
||||
NumThreads = 20 # IO threads aren't attached to CPU count
|
||||
ThreadTestLoops {.intdefine.} = 1000
|
||||
ThreadTestLoops {.intdefine.} = 1
|
||||
N = ThreadTestLoops
|
||||
ThreadTestInnerLoops {.intdefine.} = 1
|
||||
M = ThreadTestInnerLoops
|
||||
|
||||
for i in 1..N:
|
||||
suite "Test Basic ThreadDatastore with SQLite":
|
||||
@ -50,7 +52,8 @@ for i in 1..N:
|
||||
(await ds.close()).tryGet()
|
||||
taskPool.shutdown()
|
||||
|
||||
basicStoreTests(ds, key, bytes, otherBytes)
|
||||
for i in 1..M:
|
||||
basicStoreTests(ds, key, bytes, otherBytes)
|
||||
GC_fullCollect()
|
||||
|
||||
for i in 1..N:
|
||||
@ -72,7 +75,8 @@ for i in 1..N:
|
||||
(await ds.close()).tryGet()
|
||||
taskPool.shutdown()
|
||||
|
||||
queryTests(ds, true)
|
||||
for i in 1..M:
|
||||
queryTests(ds, true)
|
||||
GC_fullCollect()
|
||||
|
||||
# suite "Test Basic ThreadDatastore with fsds":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user