await all

This commit is contained in:
Jaremy Creechley 2023-09-26 00:02:44 -07:00
parent fddbb99a98
commit ca9edb2798
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 5 additions and 3 deletions

View File

@ -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)

View File

@ -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*(