Delete closed bugs after 5 days in recheckwatch

Instead of leaving closed bugs around for 30 days, remove them after 5
days.  If a closed bug hasn't reoccurred in 5 days there is a good chance
it has been fixed correctly.  The number of days to keep around a closed
bug is set in by closed_age in the config file.

Change-Id: I5d136173ca14a8f9e77a44e29e9499c94a417cd3
This commit is contained in:
Joe Gordon 2013-09-11 18:05:48 -07:00
parent 151ade5298
commit 1ee0025c0b
2 changed files with 6 additions and 1 deletions

View File

@ -102,6 +102,7 @@ class Scoreboard(threading.Thread):
self.template_dir = config.get('recheckwatch', 'template_dir')
self.output_file = config.get('recheckwatch', 'output_file')
self.age = config.getint('recheckwatch', 'age')
self.closed_age = config.getint('recheckwatch', 'closed_age')
self.regex = re.compile(config.get('recheckwatch', 'regex'))
if os.path.exists(self.pickle_file):
@ -161,10 +162,13 @@ class Scoreboard(threading.Thread):
del self.scores[bugno]
# Remove bugs that haven't been seen in ages
# Or closed bugs older then self.closed_age
to_remove = []
now = datetime.datetime.utcnow()
for bugno, bug in self.scores.items():
if bug.last_seen < now-datetime.timedelta(days=self.age):
if (bug.last_seen < now-datetime.timedelta(days=self.age) or
(bug.is_closed() and
bug.last_seen < now-datetime.timedelta(days=self.closed_age))):
to_remove.append(bugno)
for bugno in to_remove:
del self.scores[bugno]

View File

@ -3,6 +3,7 @@ pickle_dir=/var/lib/recheckwatch
template_dir=/var/lib/recheckwatch
output_file=/var/www/recheckwatch/rechecks.html
age=30 ; days
closed_age=5 ; days
regex=(?i)^(?P<verb>recheck|reverify) (?:bug|lp)[\s#:]*(?P<bugno>\d+)$
[gerrit]