diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2016-02-23 16:05:38 +0100 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2016-02-23 16:05:38 +0100 |
commit | b9d24494586db59d4bf316a2fac875967b21c17a (patch) | |
tree | e1afc40a27abdc91c7c7564a3f1b9b799f953cf4 /service/pixelated/bitmask_libraries | |
parent | 9e79c3b4e948e5d8ae1adab4fad7b49b50fe77c3 (diff) |
Only do initial sync on session creation
- Issue #615
- Fixed some long broken but not failing tests
Diffstat (limited to 'service/pixelated/bitmask_libraries')
-rw-r--r-- | service/pixelated/bitmask_libraries/session.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/service/pixelated/bitmask_libraries/session.py b/service/pixelated/bitmask_libraries/session.py index 9e908ce5..f28d9f59 100644 --- a/service/pixelated/bitmask_libraries/session.py +++ b/service/pixelated/bitmask_libraries/session.py @@ -53,12 +53,20 @@ class LeapSession(object): self.fresh_account = False self.incoming_mail_fetcher = None self.account = None + self._has_been_synced = False + self._sem_intial_sync = defer.DeferredLock() register(events.KEYMANAGER_FINISHED_KEY_GENERATION, self._set_fresh_account, uid=self.account_email()) @defer.inlineCallbacks def initial_sync(self): - yield self.sync() - yield self.after_first_sync() + yield self._sem_intial_sync.acquire() + try: + if not self._has_been_synced: + yield self.sync() + yield self.after_first_sync() + self._has_been_synced = True + finally: + yield self._sem_intial_sync.release() defer.returnValue(self) @defer.inlineCallbacks |