mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-03 22:23:10 +00:00
await all
This commit is contained in:
parent
fddbb99a98
commit
ca9edb2798
@ -29,7 +29,7 @@ func new*(_: type AsyncSemaphore, size: int): AsyncSemaphore =
|
|||||||
|
|
||||||
proc `count`*(s: AsyncSemaphore): int = s.count
|
proc `count`*(s: AsyncSemaphore): int = s.count
|
||||||
|
|
||||||
proc waitAll*(s: AsyncSemaphore) {.async.} =
|
proc closeAll*(s: AsyncSemaphore) {.async.} =
|
||||||
s.exit = true
|
s.exit = true
|
||||||
await allFutures(s.queue)
|
await allFutures(s.queue)
|
||||||
|
|
||||||
|
|||||||
@ -209,8 +209,10 @@ method get*(self: ThreadDatastore,
|
|||||||
self.tp.spawn getTask(addr ctx, ds, key)
|
self.tp.spawn getTask(addr ctx, ds, key)
|
||||||
|
|
||||||
method close*(self: ThreadDatastore): Future[?!void] {.async.} =
|
method close*(self: ThreadDatastore): Future[?!void] {.async.} =
|
||||||
|
await self.semaphore.closeAll()
|
||||||
await self.ds.close()
|
case self.backend.kind:
|
||||||
|
of Sqlite:
|
||||||
|
self.backend.sql.close()
|
||||||
|
|
||||||
|
|
||||||
method query*(
|
method query*(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user