From b563b4a5148a04bad2c59b27231a3e71763c931b Mon Sep 17 00:00:00 2001 From: Joe Gordon <joe.gordon0@gmail.com> Date: Wed, 11 Sep 2013 10:57:52 -0700 Subject: [PATCH] if duplicate bug not in recheckwatch, add it in I19b25bb9595330393e664e9499204083b18ab5c9 added support delete duplicate bugs, but it didn't make sure the duplicate bug was already tracked in recheckwatch. Change-Id: I46bd034990e4470fcaf072da45ca55886ad3ba7d --- modules/recheckwatch/files/recheckwatch | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/recheckwatch/files/recheckwatch b/modules/recheckwatch/files/recheckwatch index 0dc7e23fee..36b64ee0f5 100755 --- a/modules/recheckwatch/files/recheckwatch +++ b/modules/recheckwatch/files/recheckwatch @@ -126,14 +126,19 @@ class Scoreboard(threading.Thread): project = change_record.get('project') bugno = int(m.group('bugno')) hit = Hit(project, change) + bug = self._get_bug(bugno) + bug.addHit(hit) + self.scores[bugno] = bug + self.update() + + def _get_bug(self, bugno): + """"Get latest bug information and create bug if not in score.""" bug = self.scores.get(bugno) if not bug: bug = Bug(bugno) else: bug.update() - bug.addHit(hit) - self.scores[bugno] = bug - self.update() + return bug def update(self): # Check for duplicate bugs @@ -142,7 +147,10 @@ class Scoreboard(threading.Thread): if bug.duplicate_of: dupes.append(bugno) for bugno in dupes: - self.scores[self.scores[bugno].duplicate_of].addHits(self.scores[bugno].hits) + dupno = self.scores[bugno].duplicate_of + bug = self._get_bug(dupno) + bug.addHits(self.scores[bugno].hits) + self.scores[dupno] = bug del self.scores[bugno] # Remove bugs that haven't been seen in ages