in crashes.py [0:0]
def cleanupStats(reports, stats):
# remove old crash and client ids we no longer have reports for
clientList = list()
crashList = list()
for hash in reports:
for report in reports[hash]['reportList']:
clientid = report['clientid']
crashid = report['crashid']
if clientid not in clientList:
clientList.append(clientid)
if crashid not in crashList:
crashList.append(crashid)
purgeClientIdList = list()
purgeCrashIdList = list()
for hash in stats:
for date in stats[hash]['crashdata'].keys():
for crashid in stats[hash]['crashdata'][date]['crashids']:
if crashid not in crashList:
if crashid not in purgeCrashIdList:
purgeCrashIdList.append(crashid)
for clientid in stats[hash]['crashdata'][date]['clientids']:
if clientid not in clientList:
if clientid not in purgeClientIdList:
purgeClientIdList.append(clientid)
for crashid in purgeCrashIdList:
for hash in stats:
for date in stats[hash]['crashdata'].keys():
if crashid in stats[hash]['crashdata'][date]['crashids']:
stats[hash]['crashdata'][date]['crashids'].remove(crashid)
for clientid in purgeClientIdList:
for hash in stats:
for date in stats[hash]['crashdata'].keys():
if clientid in stats[hash]['crashdata'][date]['clientids']:
stats[hash]['crashdata'][date]['clientids'].remove(clientid)
print("Removed %d old client ids and %d old crash ids tracked in stats." % (len(purgeClientIdList), len(purgeCrashIdList)))
return True