Wake up next getter after peak.

This commit is contained in:
bhartnett 2024-10-02 22:42:50 +08:00
parent 925e6ca9b4
commit 76f7191a0a
No known key found for this signature in database
GPG Key ID: 076F2830DA6BD535

View File

@ -397,7 +397,9 @@ proc peakFirst*[T](aq: AsyncQueue[T]): Future[T] {.
if not(aq.empty()) and not(getter.cancelled()):
aq.getters.wakeupNext()
raise exc
aq.peakFirstImpl()
let res = aq.peakFirstImpl()
aq.getters.wakeupNext()
res
proc peakLast*[T](aq: AsyncQueue[T]): Future[T] {.
async: (raises: [CancelledError]).} =
@ -413,7 +415,9 @@ proc peakLast*[T](aq: AsyncQueue[T]): Future[T] {.
if not(aq.empty()) and not(getter.cancelled()):
aq.getters.wakeupNext()
raise exc
aq.peakLastImpl()
let res = aq.peakLastImpl()
aq.getters.wakeupNext()
res
proc putNoWait*[T](aq: AsyncQueue[T], item: T) {.
raises: [AsyncQueueFullError].} =