running 1000+ outer loops

This commit is contained in:
Jaremy Creechley 2023-09-27 14:01:21 -07:00
parent fbc00613c4
commit efd2e1d19d
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 13 additions and 13 deletions

View File

@ -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()

View File

@ -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()