Patchwork [1,of,3] lfs: default to not using workers for upload/download

login
register
mail settings
Submitter Matt Harbison
Date Jan. 18, 2018, 11:51 p.m.
Message ID <3e89ebf3fc09542792ec.1516319501@MATT7H-PC.attotech.com>
Download mbox | patch
Permalink /patch/26938/
State Accepted
Headers show

Comments

Matt Harbison - Jan. 18, 2018, 11:51 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1516306294 18000
#      Thu Jan 18 15:11:34 2018 -0500
# Node ID 3e89ebf3fc09542792ecccb41c9ea923e270bf76
# Parent  7ffbd911dbc94215248500f0f95064cf3b975144
lfs: default to not using workers for upload/download

I ran into truncated uploads with this defaulting to on.  Wojciech Lis diagnosed
it as creating keepalive connections prior to forking, and illegally
multiplexing the same connection. [1]  I didn't notice a problem with the couple
of downloads I tried, but disabled both for simplicity and safety.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-January/109916.html

Patch

diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -118,6 +118,9 @@  configitem = registrar.configitem(config
 configitem('experimental', 'lfs.user-agent',
     default=None,
 )
+configitem('experimental', 'lfs.worker-enable',
+    default=False,
+)
 
 configitem('lfs', 'url',
     default=None,
diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
--- a/hgext/lfs/blobstore.py
+++ b/hgext/lfs/blobstore.py
@@ -356,8 +356,13 @@  class _gitlfsremote(object):
                             continue
                         raise
 
-        oids = worker.worker(self.ui, 0.1, transfer, (),
-                             sorted(objects, key=lambda o: o.get('oid')))
+        # Until https multiplexing gets sorted out
+        if self.ui.configbool('experimental', 'lfs.worker-enable'):
+            oids = worker.worker(self.ui, 0.1, transfer, (),
+                                 sorted(objects, key=lambda o: o.get('oid')))
+        else:
+            oids = transfer(sorted(objects, key=lambda o: o.get('oid')))
+
         processed = 0
         for _one, oid in oids:
             processed += sizes[oid]