diff --git a/datastore/datastore2.nim b/datastore/datastore2.nim index 3bacf9b..78bb434 100644 --- a/datastore/datastore2.nim +++ b/datastore/datastore2.nim @@ -11,7 +11,7 @@ type delete*: proc(self: SharedPtr[T], key: KeyBuffer): ?!void {.nimcall, gcsafe, raises: [].} get*: proc(self: SharedPtr[T], key: KeyBuffer): ?!ValueBuffer {.nimcall, gcsafe, raises: [].} put*: proc(self: SharedPtr[T], key: KeyBuffer, data: ValueBuffer): ?!void {.nimcall, gcsafe, raises: [].} - close*: proc(self: SharedPtr[T]): ?!void {.gcsafe, raises: [].} + close*: proc(self: SharedPtr[T]): ?!void {.nimcall, gcsafe, raises: [].} ids*: SharedPtr[T] proc has*[T](self: Datastore2[T], key: KeyBuffer): ?!bool = @@ -23,6 +23,4 @@ proc get*[T](self: Datastore2[T], key: KeyBuffer): ?!ValueBuffer {.nimcall.} = proc put*[T](self: Datastore2[T], key: KeyBuffer, data: ValueBuffer): ?!void {.nimcall.} = self.put(self.ids, key, data) proc close*[T](self: Datastore2[T]): ?!void {.nimcall.} = - echo "CLOSE: ", self - echo "CLOSE: ", self.ids.repr self.close(self.ids) diff --git a/datastore/memoryds.nim b/datastore/memoryds.nim index a58605d..d567388 100644 --- a/datastore/memoryds.nim +++ b/datastore/memoryds.nim @@ -24,7 +24,7 @@ push: {.upraises: [].} type MemoryDatastore* = object lock*: Lock - store*: SimpleTable[10_000] + store*: SimpleTable[100] proc has(self: SharedPtr[MemoryDatastore], key: KeyBuffer): ?!bool = diff --git a/datastore/threadproxyds.nim b/datastore/threadproxyds.nim index efbf537..a7e02ca 100644 --- a/datastore/threadproxyds.nim +++ b/datastore/threadproxyds.nim @@ -193,7 +193,7 @@ method close*[T]( if self.tds[].tp != nil: ## this can block... how to handle? maybe just leak? self.tds[].tp.shutdown() - self[].tds[].tp = nil # ensure our sharedptr doesn't try and dealloc + # self[].tds[].tp = nil # ensure our sharedptr doesn't try and dealloc self.tds.release() echo "close done" diff --git a/tests/datastore/testthreadproxyds.nim b/tests/datastore/testthreadproxyds.nim index fc49bd8..d063eb7 100644 --- a/tests/datastore/testthreadproxyds.nim +++ b/tests/datastore/testthreadproxyds.nim @@ -30,10 +30,10 @@ proc testThreadProxy() = key1 = Key.init("/a").tryGet data = "value for 1".toBytes() - # teardownAll: - # let res = await sds.close() - # res.get() - # echo "teardown done" + teardownAll: + let res = await sds.close() + res.get() + echo "teardown done" test "check put": # echo "\n\n=== put ==="