From debb86dfc9cf70d310bd3b45dc32c91d5d26b9d1 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Wed, 24 Aug 2016 18:39:48 -0300 Subject: [#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 --- service/pixelated/bitmask_libraries/provider.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'service/pixelated/bitmask_libraries/provider.py') 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'] -- cgit v1.2.3