Commit a49947bf authored by Leo Pound Singer's avatar Leo Pound Singer Committed by Leo Pound Singer
Browse files

Remove request to priming URL

The priming URL request does not seem to be required for
authentication. Removing it speeds up every GraceDB POST
request by 300-400 ms.
parent 01c5bc20
Pipeline #91606 passed with stages
in 8 minutes and 45 seconds
......@@ -433,7 +433,7 @@ class GsiRest(object):
return response
def request(self, method, url, body=None, headers=None, priming_url=None):
def request(self, method, url, body=None, headers=None):
# Bug in Python (versions < 2.7.1 (?))
# http://bugs.python.org/issue11898
# if the URL is unicode and the body of a request is binary,
......@@ -443,7 +443,6 @@ class GsiRest(object):
# This is probably bad in general,
# but for our purposes, today, this will do.
url = url and str(url)
priming_url = priming_url and str(priming_url)
headers = headers or {}
conn = self.getConnection()
......@@ -454,19 +453,6 @@ class GsiRest(object):
if (self.auth_type == 'basic'):
headers.update(self.authn_header)
# Set up priming URL for certain requests using X509 auth
if (self.auth_type == 'x509' and priming_url):
priming_header = {'connection': 'keep-alive'}
priming_header.update(self.version_header)
response = self.make_request_and_get_response(
conn, "GET", priming_url, headers=priming_header
)
if response.status != 200:
response = self.adjustResponse(response)
else:
# Throw away the response and make sure to read the body.
response = response.read()
response = self.make_request_and_get_response(
conn, method, url, body=body, headers=headers
)
......@@ -811,12 +797,6 @@ class GraceDb(GsiRest):
"""List of available signoff statuses on the server."""
return self.service_info.get('signoff-statuses')
def request(self, method, url, body=None, headers=None, priming_url=None):
if (method.upper() in ['POST', 'PUT'] and self.auth_type == 'x509'):
priming_url = self._service_url
return super(GraceDb, self).request(
method, url, body, headers, priming_url)
def _getCode(self, input_value, code_dict):
"""
Check if input is valid and return coded version if it is
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment