# HG changeset patch
# User Manuel Jacob <m...@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():

_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to