From 542d532619bac12e201705d6deb42d116bb93369 Mon Sep 17 00:00:00 2001 From: Tim Flink Date: May 24 2013 20:43:04 +0000 Subject: fix sync so that when --full is specified, a full sync actually happens --- diff --git a/blockerbugs/cli.py b/blockerbugs/cli.py index 5cfc306..52bddd0 100644 --- a/blockerbugs/cli.py +++ b/blockerbugs/cli.py @@ -157,13 +157,7 @@ def sync_bugs(fullsync = False, docheck = False): sync = BugSync(db, url=bzurl) - # a full sync is triggered by passing in the last update time as None - if not fullsync: - last_updated = current_milestone.last_bug_sync - else: - last_updated = None - - sync.update_active(last_updated) + sync.update_active(full_sync = fullsync) if docheck: print "Checking bug sync status" diff --git a/blockerbugs/util/bug_sync.py b/blockerbugs/util/bug_sync.py index 6e092aa..dec53ce 100644 --- a/blockerbugs/util/bug_sync.py +++ b/blockerbugs/util/bug_sync.py @@ -139,7 +139,7 @@ class BugSync(): self.db.session.commit() - def update_active(self, lastupdate=None): + def update_active(self, full_sync = False): starttime = datetime.utcnow() active_milestones = Milestone.query.filter_by(active=True).all() self.log.info("Starting blocker sync") @@ -147,13 +147,17 @@ class BugSync(): # for each active milestone, update the tracker to remove any bugs that # no longer block tracker and pull in any new bugs for milestone in active_milestones: + last_sync_time = milestone.last_bug_sync + if full_sync: + last_sync_time = None + self.log.info("Syncing blockers for milestone %s" % milestone) self.cleanup_milestone(milestone, 'Blocker') - self.update_milestone(milestone, 'Blocker', milestone.last_bug_sync) + self.update_milestone(milestone, 'Blocker', last_sync_time) self.log.info("Syncing FE for milestone %s" % milestone) self.cleanup_milestone(milestone, 'FreezeException') - self.update_milestone(milestone, 'FreezeException', milestone.last_bug_sync) + self.update_milestone(milestone, 'FreezeException', last_sync_time) # update the last query time for the milestone milestone.last_bug_sync = starttime