From efd2e1d19d9f792fe7b5e4642e737634c2d34191 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Wed, 27 Sep 2023 14:01:21 -0700 Subject: [PATCH] running 1000+ outer loops --- datastore/threads/threadproxyds.nim | 10 +++++----- tests/datastore/testthreadproxyds.nim | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/datastore/threads/threadproxyds.nim b/datastore/threads/threadproxyds.nim index 4a6e514..3085d6c 100644 --- a/datastore/threads/threadproxyds.nim +++ b/datastore/threads/threadproxyds.nim @@ -68,7 +68,7 @@ proc setDone[T](ctx: TaskCtx[T]) = ctx[].running = false proc acquireSignal(): ?!ThreadSignalPtr = - echo "signal:OPEN!" + # echo "signal:OPEN!" let signal = ThreadSignalPtr.new() if signal.isErr(): failure (ref CatchableError)(msg: "failed to aquire ThreadSignalPtr: " & signal.error()) @@ -126,7 +126,7 @@ template dispatchTask[BT](self: ThreadDatastore[BT], ctx.setCancelled() raise exc finally: - echo "signal:CLOSE!" + # echo "signal:CLOSE!" discard ctx[].signal.close() self.semaphore.release() @@ -286,13 +286,13 @@ method query*[BT](self: ThreadDatastore[BT], without signal =? acquireSignal(), err: return failure err let ctx = newTaskCtx(QResult, signal=signal) - echo "nextSignal:OPEN!" + # echo "nextSignal:OPEN!" ctx[].nextSignal.init() proc iterDispose() = - echo "signal:CLOSE!" + # echo "signal:CLOSE!" discard signal.close() - echo "nextSignal:CLOSE!" + # echo "nextSignal:CLOSE!" ctx[].nextSignal.close() self.semaphore.release() diff --git a/tests/datastore/testthreadproxyds.nim b/tests/datastore/testthreadproxyds.nim index 0926f07..8ab5339 100644 --- a/tests/datastore/testthreadproxyds.nim +++ b/tests/datastore/testthreadproxyds.nim @@ -33,9 +33,9 @@ for i in 1..N: suite "Test Basic ThreadDatastore with SQLite": var - sqlStore = newSQLiteBackend[KeyId, DataBuffer](Memory).tryGet() - taskPool = Taskpool.new(NumThreads) - ds = ThreadDatastore.new(sqlStore, tp = taskPool).tryGet() + sqlStore: SQLiteBackend[KeyId, DataBuffer] + taskPool: Taskpool + ds: ThreadDatastore[SQLiteBackend[KeyId, DataBuffer]] key = Key.init("/a/b").tryGet() bytes = "some bytes".toBytes otherBytes = "some other bytes".toBytes @@ -52,17 +52,17 @@ for i in 1..N: (await ds.close()).tryGet() taskPool.shutdown() - # for i in 1..M: - # basicStoreTests(ds, key, bytes, otherBytes) + for i in 1..M: + basicStoreTests(ds, key, bytes, otherBytes) GC_fullCollect() for i in 1..N: suite "Test Query ThreadDatastore with SQLite": var - sqlStore = newSQLiteBackend[KeyId, DataBuffer](Memory).tryGet() - taskPool = Taskpool.new(NumThreads) - ds = ThreadDatastore.new(sqlStore, tp = taskPool).tryGet() + sqlStore: SQLiteBackend[KeyId, DataBuffer] + taskPool: Taskpool + ds: ThreadDatastore[SQLiteBackend[KeyId, DataBuffer]] setup: sqlStore = newSQLiteBackend[KeyId, DataBuffer](Memory).tryGet()