Be more resilient when querying bugzilla for open bugs
Sometime we fail to retrieve the list of bugs for a component because of some hick ups with bugzilla. With this commit, we'll try up to 5 times and wait 20 seconds before each attempts. If that still fails, then too bad. Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
parent
f17f2ae9df
commit
7b1f707efc
1 changed files with 16 additions and 1 deletions
|
@ -272,7 +272,22 @@ class BugzillaProxy:
|
|||
# Update only maintained releases
|
||||
bz_query['version'] = self.config["products"][product]["versions"]
|
||||
|
||||
query_results = self.server.query(bz_query)
|
||||
def _query_bz(query, num_attempts=5):
|
||||
for i in range(num_attempts):
|
||||
try:
|
||||
raw_data = self.server.query(bz_query)
|
||||
break
|
||||
except Exception as e:
|
||||
if i >= num_attempts - 1:
|
||||
raise
|
||||
if self.config['verbose']:
|
||||
print(f" ERROR {e}")
|
||||
print(" - Query failed, going to try again in 20 seconds")
|
||||
# Wait 20 seconds and try again
|
||||
time.sleep(20)
|
||||
return raw_data
|
||||
|
||||
query_results = _query_bz(bz_query)
|
||||
|
||||
for bug in query_results:
|
||||
if bug.assigned_to == prev_poc and bug.assigned_to != new_poc:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue