diff --git a/datastore/threads/asyncsemaphore.nim b/datastore/threads/asyncsemaphore.nim index 1735460..b561882 100644 --- a/datastore/threads/asyncsemaphore.nim +++ b/datastore/threads/asyncsemaphore.nim @@ -29,7 +29,7 @@ func new*(_: type AsyncSemaphore, size: int): AsyncSemaphore = proc `count`*(s: AsyncSemaphore): int = s.count -proc waitAll*(s: AsyncSemaphore) {.async.} = +proc closeAll*(s: AsyncSemaphore) {.async.} = s.exit = true await allFutures(s.queue) diff --git a/datastore/threads/threadproxyds.nim b/datastore/threads/threadproxyds.nim index c0fc8a0..35237bc 100644 --- a/datastore/threads/threadproxyds.nim +++ b/datastore/threads/threadproxyds.nim @@ -209,8 +209,10 @@ method get*(self: ThreadDatastore, self.tp.spawn getTask(addr ctx, ds, key) method close*(self: ThreadDatastore): Future[?!void] {.async.} = - - await self.ds.close() + await self.semaphore.closeAll() + case self.backend.kind: + of Sqlite: + self.backend.sql.close() method query*(