diff --git a/datastore/threads/threadproxyds.nim b/datastore/threads/threadproxyds.nim index 8a543b8..ae9f64c 100644 --- a/datastore/threads/threadproxyds.nim +++ b/datastore/threads/threadproxyds.nim @@ -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() diff --git a/tests/datastore/testthreadproxyds.nim b/tests/datastore/testthreadproxyds.nim index c5b6ab0..e0cb822 100644 --- a/tests/datastore/testthreadproxyds.nim +++ b/tests/datastore/testthreadproxyds.nim @@ -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":