From 76f7191a0a8bfae59e747ab52088ee4b391a6cdd Mon Sep 17 00:00:00 2001 From: bhartnett <51288821+bhartnett@users.noreply.github.com> Date: Wed, 2 Oct 2024 22:42:50 +0800 Subject: [PATCH] Wake up next getter after peak. --- chronos/asyncsync.nim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chronos/asyncsync.nim b/chronos/asyncsync.nim index 12c9e250..f36a1d92 100644 --- a/chronos/asyncsync.nim +++ b/chronos/asyncsync.nim @@ -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].} =