From 945405e8b414decf5084b0b740253a987121e91d Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Wed, 18 Aug 2010 17:01:49 +0000 Subject: [PATCH] Add flushing to gclient revert. Otherwise, if someone flush svn:ignore in src/third_part by error and that causes a lot of files to be deleted, buildbot may hang while waiting for output. BUG=Previous behavior killed the win try slaves. TEST=smoke tests Review URL: http://codereview.chromium.org/3171015 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@56541 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient_scm.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gclient_scm.py b/gclient_scm.py index c4484a216..74b028195 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -9,6 +9,7 @@ import os import posixpath import re import subprocess +import sys import time import scm @@ -873,6 +874,11 @@ class SVNWrapper(SCMWrapper): # Don't reuse the args. return self.update(options, [], file_list) + # Do a flush of sys.stdout every 10 secs or so otherwise it may never be + # flushed fast enough for buildbot. + last_flushed_at = time.time() + sys.stdout.flush() + for file_status in scm.SVN.CaptureStatus(path): file_path = os.path.join(path, file_status[1]) if file_status[0][0] == 'X': @@ -884,6 +890,13 @@ class SVNWrapper(SCMWrapper): logging.info('%s%s' % (file[0], file[1])) else: print(file_path) + # Flush at least 10 seconds between line writes. We wait at least 10 + # seconds to avoid overloading the reader that called us with output, + # which can slow busy readers down. + if (time.time() - last_flushed_at) > 10: + last_flushed_at = time.time() + sys.stdout.flush() + if file_status[0].isspace(): logging.error('No idea what is the status of %s.\n' 'You just found a bug in gclient, please ping '