diff options
author | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-08-24 18:39:48 -0300 |
---|---|---|
committer | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-08-24 18:39:48 -0300 |
commit | debb86dfc9cf70d310bd3b45dc32c91d5d26b9d1 (patch) | |
tree | 3acbc834d025c9c0a8e0ba2644c5abcb12fa519a | |
parent | f758f916fe585e55b17f61291de8733e3afe379d (diff) |
[#762] Remove smtp-service download from session creation
SMTP json is a blocking HTTP request that was taking ~1 sec
of the session creation. We moved it to the UA initialization
-rw-r--r-- | service/pixelated/bitmask_libraries/provider.py | 6 | ||||
-rw-r--r-- | service/pixelated/config/leap.py | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/service/pixelated/bitmask_libraries/provider.py b/service/pixelated/bitmask_libraries/provider.py index cd4af7e2..02318ec2 100644 --- a/service/pixelated/bitmask_libraries/provider.py +++ b/service/pixelated/bitmask_libraries/provider.py @@ -68,6 +68,9 @@ class LeapProvider(object): def download_soledad_json(self): self.soledad_json = self.fetch_soledad_json() + def download_smtp_json(self): + self.smtp_json = self.fetch_smtp_json() + def download_certificate(self, filename=None): """ Downloads the server certificate, validates it against the provided fingerprint and stores it to file @@ -113,8 +116,7 @@ class LeapProvider(object): raise Exception('Certificate fingerprints don\'t match! Expected [%s] but got [%s]' % (fingerprint.strip(), digest)) def smtp_info(self): - json_data = self.fetch_smtp_json() - hosts = json_data['hosts'] + hosts = self.smtp_json['hosts'] hostname = hosts.keys()[0] host = hosts[hostname] return host['hostname'], host['port'] diff --git a/service/pixelated/config/leap.py b/service/pixelated/config/leap.py index 52e84386..91c8db1f 100644 --- a/service/pixelated/config/leap.py +++ b/service/pixelated/config/leap.py @@ -22,6 +22,7 @@ def initialize_leap_provider(provider_hostname, provider_cert, provider_fingerpr provider.download_certificate() LeapCertificate(provider).setup_ca_bundle() provider.download_soledad_json() + provider.download_smtp_json() return provider |