Mercurial > public > mercurial-scm > hg-stable
diff hgext/lfs/blobstore.py @ 49537:3556f0392808 stable
lfs: avoid closing connections when the worker doesn't fork
Probably not much more than an minor optimization, but could be useful in the
case of `hg verify` where missing blobs are fetched one at a time.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 18 Oct 2022 13:56:45 -0400 |
parents | abf471862b8e |
children | 18282cf18aa2 |
line wrap: on
line diff
--- a/hgext/lfs/blobstore.py Tue Oct 18 13:36:33 2022 -0400 +++ b/hgext/lfs/blobstore.py Tue Oct 18 13:56:45 2022 -0400 @@ -597,7 +597,9 @@ continue raise - # Until https multiplexing gets sorted out + # Until https multiplexing gets sorted out. It's not clear if + # ConnectionManager.set_ready() is externally synchronized for thread + # safety with Windows workers. if self.ui.configbool(b'experimental', b'lfs.worker-enable'): # The POSIX workers are forks of this process, so before spinning # them up, close all pooled connections. Otherwise, there's no way @@ -608,7 +610,7 @@ # ready connections as in use, and roll that back after the fork? # That would allow the existing pool of connections in this process # to be preserved. - if not pycompat.iswindows: + def prefork(): for h in self.urlopener.handlers: getattr(h, "close_all", lambda: None)() @@ -618,6 +620,7 @@ transfer, (), sorted(objects, key=lambda o: o.get(b'oid')), + prefork=prefork, ) else: oids = transfer(sorted(objects, key=lambda o: o.get(b'oid')))