From da85dcd669e317cb78eb371fea98b2b5608e2dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Mon, 23 Jan 2012 18:18:51 +0100 Subject: [PATCH] - handle timeout situation in "results -w" call --- osc/core.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/osc/core.py b/osc/core.py index 4c05c85c..353e8b26 100644 --- a/osc/core.py +++ b/osc/core.py @@ -4703,8 +4703,17 @@ def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[], ve while True: waiting = False - r = [] - for res in get_package_results(apiurl, prj, package, lastbuild, repository, arch, oldstate): + results = r = [] + try: + results = get_package_results(apiurl, prj, package, lastbuild, repository, arch, oldstate) + except urllib2.HTTPError, e: + # check for simple timeout error and fetch again + if e.code != 502: + raise + # re-try result request + continue + + for res in results: if res.has_key('_oldstate'): oldstate = res['_oldstate'] continue @@ -4722,7 +4731,7 @@ def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[], ve res['status'] = 'outdated (was: %s)' % res['status'] else: res['status'] += '*' - if res['status'] in ('scheduled', 'finished', 'building', 'signing', 'dispatching'): + if res['status'] in ('blocked', 'scheduled', 'dispatching', 'building', 'signing', 'finished'): waiting=True r.append(result_line_templ % res)