changeset 27399:425dc70037f7

dirstate: make delaywrite sleep until the next multiple of n seconds Rather than sleep for 2 seconds, we sleep until the next even-numbered second, which has the same effect, but makes tests faster. This removes test-largefiles-update as the long pole of the test suite.
author Matt Mackall <mpm@selenic.com>
date Wed, 16 Dec 2015 20:58:26 -0600
parents c81675776c95
children 64208bd4c580
files mercurial/dirstate.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Wed Dec 16 20:49:18 2015 -0600
+++ b/mercurial/dirstate.py	Wed Dec 16 20:58:26 2015 -0600
@@ -712,7 +712,12 @@
             for f, e in self._map.iteritems():
                 if e[0] == 'n' and e[3] == now:
                     import time # to avoid useless import
-                    time.sleep(delaywrite)
+                    # rather than sleep n seconds, sleep until the next
+                    # multiple of n seconds
+                    clock = time.time()
+                    start = int(clock) - (int(clock) % delaywrite)
+                    end = start + delaywrite
+                    time.sleep(end - clock)
                     break
 
         st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now))