QUERY · ISSUE
extmod/uasyncio: Queue is missing
The new uasyncio doesn't have a Queue class (unless I'm getting blind?). That seems like a pretty core sync primitive. Should this be added or should that go into a separate library? There's also Condition, Semaphone and more... Where should such a library go or what is the plan?
CANDIDATE · ISSUE
uasyncio.queue: bug testing queue size in put() function
The put() function tests for queue size greater than max queue size, instead of queue size greater than or equal to max queue size.
diff --git a/uasyncio.queues/uasyncio/queues.py b/uasyncio.queues/uasyncio/queues.py
index 4a8ae5f..04918ae 100644
--- a/uasyncio.queues/uasyncio/queues.py
+++ b/uasyncio.queues/uasyncio/queues.py
@@ -61,7 +61,7 @@ class Queue:
yield from queue.put(item)
"""
- while self.qsize() > self.maxsize and self.maxsize:
+ while self.qsize() >= self.maxsize and self.maxsize:
yield from sleep(self._attempt_delay)
self._put(val)
Thanks for the report. uasyncio.queues was contributed (I didn't look into it myself much), but the fix looks right, especially that in put_nowait() it uses >=. Merging.
@nvbn: FYI
Fixed, thanks.