mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-02 13:43:11 +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 waitAll*(s: AsyncSemaphore) {.async.} =
|
||||
proc closeAll*(s: AsyncSemaphore) {.async.} =
|
||||
s.exit = true
|
||||
await allFutures(s.queue)
|
||||
|
||||
|
||||
@ -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*(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user