diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-07-20 11:08:11 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:25 +0200 |
commit | a759db8bc3c3f9b826f3332da11f090e5c758ee5 (patch) | |
tree | 13f04d72f2c3e3f805f897fdcbff0aa7bc906937 /service/pixelated | |
parent | 9e8ca28f060362e1540deb87153fde4161d39161 (diff) |
Enable initial sync and background jobs.
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/application.py | 3 | ||||
-rw-r--r-- | service/pixelated/bitmask_libraries/session.py | 12 | ||||
-rw-r--r-- | service/pixelated/config/leap.py | 7 |
3 files changed, 15 insertions, 7 deletions
diff --git a/service/pixelated/application.py b/service/pixelated/application.py index 68bb70b2..eafeede7 100644 --- a/service/pixelated/application.py +++ b/service/pixelated/application.py @@ -84,6 +84,9 @@ def initialize(): args.leap_home)) deferred.addCallback( + lambda leap_session: leap_session.initial_sync()) + + deferred.addCallback( lambda leap_session: start_user_agent( loading_app, args.host, diff --git a/service/pixelated/bitmask_libraries/session.py b/service/pixelated/bitmask_libraries/session.py index d1bdac73..50f5e7c7 100644 --- a/service/pixelated/bitmask_libraries/session.py +++ b/service/pixelated/bitmask_libraries/session.py @@ -62,11 +62,12 @@ class LeapSession(object): self.account = soledad_account self.incoming_mail_fetcher = incoming_mail_fetcher - d = self.sync() - d.addCallback(lambda _: self.nicknym.generate_openpgp_key()) - - if self.config.start_background_jobs: - d.addCallback(lambda _: self.start_background_jobs()) + @defer.inlineCallbacks + def initial_sync(self): + yield self.sync() + yield self.nicknym.generate_openpgp_key() + yield self.start_background_jobs() + defer.returnValue(self) def account_email(self): name = self.user_auth.username @@ -78,6 +79,7 @@ class LeapSession(object): @defer.inlineCallbacks def start_background_jobs(self): self.incoming_mail_fetcher = yield self.incoming_mail_fetcher + reactor.callFromThread(self.incoming_mail_fetcher.startService) def stop_background_jobs(self): diff --git a/service/pixelated/config/leap.py b/service/pixelated/config/leap.py index c28c371b..3a0f96fd 100644 --- a/service/pixelated/config/leap.py +++ b/service/pixelated/config/leap.py @@ -6,8 +6,9 @@ from pixelated.bitmask_libraries.config import LeapConfig from pixelated.bitmask_libraries.certs import LeapCertificate from pixelated.bitmask_libraries.provider import LeapProvider from pixelated.bitmask_libraries.session import LeapSessionFactory +from twisted.internet import defer - +@defer.inlineCallbacks def initialize_leap(leap_provider_cert, leap_provider_cert_fingerprint, credentials_file, @@ -23,7 +24,9 @@ def initialize_leap(leap_provider_cert, LeapCertificate(provider).setup_ca_bundle() leap_session = LeapSessionFactory(provider).create(username, password) - return leap_session + yield leap_session.initial_sync() + + defer.returnValue(leap_session) def init_monkeypatches(): |