mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-04 06:33:11 +00:00
running 1000+ outer loops
This commit is contained in:
parent
fbc00613c4
commit
efd2e1d19d
@ -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()
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user