summaryrefslogtreecommitdiff
path: root/service/pixelated/bitmask_libraries/provider.py
diff options
context:
space:
mode:
authorTulio Casagrande <tcasagra@thoughtworks.com>2016-08-24 18:39:48 -0300
committerTulio Casagrande <tcasagra@thoughtworks.com>2016-08-24 18:39:48 -0300
commitdebb86dfc9cf70d310bd3b45dc32c91d5d26b9d1 (patch)
tree3acbc834d025c9c0a8e0ba2644c5abcb12fa519a /service/pixelated/bitmask_libraries/provider.py
parentf758f916fe585e55b17f61291de8733e3afe379d (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
Diffstat (limited to 'service/pixelated/bitmask_libraries/provider.py')
-rw-r--r--service/pixelated/bitmask_libraries/provider.py6
1 files changed, 4 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']