changeset 49230:5d28246b9acc

worker: explain why pickle reading stream has to be unbuffered
author Manuel Jacob <me@manueljacob.de>
date Sat, 21 May 2022 22:22:19 +0200
parents ed9170ff791a
children 4d42a5fb70bf
files mercurial/worker.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/worker.py	Tue May 17 13:53:14 2022 +0100
+++ b/mercurial/worker.py	Sat May 21 22:22:19 2022 +0200
@@ -280,6 +280,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():