[PATCH 1 of 4] worker: explain why pickle reading stream has to be unbuffered
Manuel Jacob
me at manueljacob.de
Sun May 22 00:37:11 UTC 2022
# HG changeset patch
# User Manuel Jacob <me at manueljacob.de>
# Date 1653164539 -7200
# Sat May 21 22:22:19 2022 +0200
# Node ID 5dfd26ed9c4eeb51bbf910ca7450bdb65f06af81
# Parent a17ffde1e71b1c9de5899ae8d5078e67c54ef1d3
# EXP-Topic worker-improvements
worker: explain why pickle reading stream has to be unbuffered
diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -265,6 +265,10 @@
selector = selectors.DefaultSelector()
for rfd, wfd in pipes:
os.close(wfd)
+ # The stream has to be unbuffered. Otherwise, if all data is read from
+ # the raw file into the buffer, the selector thinks that the FD is not
+ # ready to read while pickle.load() could read from the buffer. This
+ # would delay the processing of readable items.
selector.register(os.fdopen(rfd, 'rb', 0), selectors.EVENT_READ)
def cleanup():
More information about the Mercurial-devel
mailing list