Mercurial > hg
diff hgext/largefiles/wirestore.py @ 17127:9e1616307c4c
largefiles: batch statlfile requests when pushing a largefiles repo (issue3386)
This implements a part of issue 3386. It batches the request for the status of
all largefiles in the revisions that are about to be pushed into a single
request, instead of doing N separate requests.
In a real world test case, this change was verified to save 1,116 round-trips to
the server. It only requires a client-side change; it is backwards-compatible
with an older version of the server.
author | Na'Tosha Bard <natosha@unity3d.com> |
---|---|
date | Sun, 24 Jun 2012 20:36:22 +0200 |
parents | 67964cda8701 |
children | ed647c59753b |
line wrap: on
line diff
--- a/hgext/largefiles/wirestore.py Wed Jul 04 02:21:04 2012 +0200 +++ b/hgext/largefiles/wirestore.py Sun Jun 24 20:36:22 2012 +0200 @@ -25,5 +25,13 @@ def _get(self, hash): return self.remote.getlfile(hash) - def _stat(self, hash): - return self.remote.statlfile(hash) + def _stat(self, hashes): + batch = self.remote.batch() + futures = {} + for hash in hashes: + futures[hash] = batch.statlfile(hash) + batch.submit() + retval = {} + for hash in hashes: + retval[hash] = not futures[hash].value + return retval