Fix wait-repo to not wait a minute if --timeout=0 is specified

Wait-repo had time.sleep(60) call before a check for timeout
expiration was done. This patch moves the check before
the sleep() call.

Signed-off-by: Tomas Mlcoch <tmlcoch@redhat.com>
This commit is contained in:
Tomas Mlcoch 2016-04-05 15:39:01 +02:00
parent 6746ce5c13
commit 60cf1f86c9

View file

@ -6571,6 +6571,14 @@ def anon_handle_wait_repo(options, session, args):
print "Successfully waited %s for %s to appear in the %s repo" % (koji.util.duration(start), koji.util.printList(suboptions.builds), tag)
return
if (time.time() - start) >= (suboptions.timeout * 60.0):
if not suboptions.quiet:
if builds:
print "Unsuccessfully waited %s for %s to appear in the %s repo" % (koji.util.duration(start), koji.util.printList(suboptions.builds), tag)
else:
print "Unsuccessfully waited %s for a new %s repo" % (koji.util.duration(start), tag)
return 1
time.sleep(60)
last_repo = repo
repo = session.getRepo(tag_id)
@ -6581,14 +6589,6 @@ def anon_handle_wait_repo(options, session, args):
print "Successfully waited %s for a new %s repo" % (koji.util.duration(start), tag)
return
if (time.time() - start) > (suboptions.timeout * 60.0):
if not suboptions.quiet:
if builds:
print "Unsuccessfully waited %s for %s to appear in the %s repo" % (koji.util.duration(start), koji.util.printList(suboptions.builds), tag)
else:
print "Unsuccessfully waited %s for a new %s repo" % (koji.util.duration(start), tag)
return 1
_search_types = ('package', 'build', 'tag', 'target', 'user', 'host', 'rpm', 'maven', 'win')
def handle_regen_repo(options, session, args):