Avoid proxy errors from bugzilla due to timeouts
Split the query we use to see if dependencies are in CLOSED state into 500-bug chunks to avoid confusing bugzilla.
This commit is contained in:
parent
fef3d7742d
commit
703371fab6
1 changed files with 18 additions and 5 deletions
|
@ -97,6 +97,20 @@ def yrmonth(str):
|
||||||
month = int(str.split('-')[1])-1
|
month = int(str.split('-')[1])-1
|
||||||
return m[month] + ' ' + year
|
return m[month] + ' ' + year
|
||||||
|
|
||||||
|
def seq_max_split(seq, max_entries):
|
||||||
|
""" Given a seq, split into a list of lists of length max_entries each. """
|
||||||
|
ret = []
|
||||||
|
num = len(seq)
|
||||||
|
seq = list(seq) # Trying to use a set/etc. here is bad
|
||||||
|
beg = 0
|
||||||
|
while num > max_entries:
|
||||||
|
end = beg + max_entries
|
||||||
|
ret.append(seq[beg:end])
|
||||||
|
beg += max_entries
|
||||||
|
num -= max_entries
|
||||||
|
ret.append(seq[beg:])
|
||||||
|
return ret
|
||||||
|
|
||||||
def run_query(bz):
|
def run_query(bz):
|
||||||
querydata = {}
|
querydata = {}
|
||||||
bugdata = {}
|
bugdata = {}
|
||||||
|
@ -127,9 +141,10 @@ def run_query(bz):
|
||||||
alldeps |= bugdata[bug.bug_id]['depends']
|
alldeps |= bugdata[bug.bug_id]['depends']
|
||||||
|
|
||||||
# Get the status of each dependency
|
# Get the status of each dependency
|
||||||
for bug in filter(None, bz.getbugssimple(list(alldeps))):
|
for i in seq_max_split(alldeps, 500):
|
||||||
if bug.bug_status == 'CLOSED':
|
for bug in filter(None, bz.getbugssimple(i)):
|
||||||
closeddeps.add(str(bug.bug_id))
|
if bug.bug_status == 'CLOSED':
|
||||||
|
closeddeps.add(str(bug.bug_id))
|
||||||
|
|
||||||
# Some special processing for those unflagged tickets
|
# Some special processing for those unflagged tickets
|
||||||
def opendep(id): return id not in closeddeps
|
def opendep(id): return id not in closeddeps
|
||||||
|
@ -313,10 +328,8 @@ def report_new(bugs, bugdata, loader, tmpdir, subs):
|
||||||
curmonth = ''
|
curmonth = ''
|
||||||
curcount = 0
|
curcount = 0
|
||||||
|
|
||||||
print 'processing new bugs'
|
|
||||||
for i in bugs:
|
for i in bugs:
|
||||||
if select_new(i, bugdata[i.bug_id]):
|
if select_new(i, bugdata[i.bug_id]):
|
||||||
print i.bug_id
|
|
||||||
rowclass = 'bz_row_even'
|
rowclass = 'bz_row_even'
|
||||||
if NEEDSPONSOR in bugdata[i.bug_id]['blockedby']:
|
if NEEDSPONSOR in bugdata[i.bug_id]['blockedby']:
|
||||||
rowclass = 'bz_state_NEEDSPONSOR'
|
rowclass = 'bz_state_NEEDSPONSOR'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue