From 60cf1f86c9a990381b66eb6c561425803189beaf Mon Sep 17 00:00:00 2001 From: Tomas Mlcoch Date: Apr 05 2016 13:39:01 +0000 Subject: 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 --- diff --git a/cli/koji b/cli/koji index c23a9db..6886343 100755 --- a/cli/koji +++ b/cli/koji @@ -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):