From: Sage Weil Date: Fri, 23 Aug 2013 22:43:35 +0000 (-0700) Subject: queue: only git fetch once per minute per branch X-Git-Tag: 1.1.0~1938^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F51%2Fhead;p=teuthology.git queue: only git fetch once per minute per branch This takes 1-2 seconds and makes launching jobs slow. Only do it once every 60 seconds per branch. Signed-off-by: Sage Weil --- diff --git a/teuthology/queue.py b/teuthology/queue.py index 9ee812d7b..f7d8aee52 100644 --- a/teuthology/queue.py +++ b/teuthology/queue.py @@ -55,12 +55,18 @@ def fetch_teuthology_branch(path, branch='master'): teuthology_git_upstream, path), cwd=os.getenv("HOME")) ) - else: + elif time.time() - os.stat('/etc/passwd').st_mtime > 60: + # only do this at most once per minute log.info("Fetching %s from upstream", branch) log.info( subprocess.check_output(('git', 'fetch', '-p', 'origin'), cwd=path) ) + log.info( + subprocess.check_output(('touch', path)) + ) + else: + log.info("%s was just updated; assuming it is current", branch) # This try/except block will notice if the requested branch doesn't # exist, whether it was cloned or fetched.