--- a/mercurial/streamclone.py Wed Feb 05 12:17:00 2025 +0100
+++ b/mercurial/streamclone.py Mon Feb 03 23:28:09 2025 +0100
@@ -1259,7 +1259,10 @@
# grab the lock to look at a possible available value
self._lock.acquire()
# disarm the lock if necessary.
- if self._wait.locked():
+ #
+ # If the queue only constains one item, keep the _wait lock
+ # armed, as there is no need to wake another waiter anyway.
+ if self._wait.locked() and len(self._queue) > 1:
self._wait.release()
return self._queue.popleft()