Skip to content

Commit

Permalink
Use connection pooling provided by requests in cloudsearch.
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek-littleinc authored and toastdriven committed May 30, 2014
1 parent 373492b commit fb3a7b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion boto/cloudsearch2/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ class SearchConnection(object):
def __init__(self, domain=None, endpoint=None):
self.domain = domain
self.endpoint = endpoint
self.session = requests.Session()

if not endpoint:
self.endpoint = domain.search_service_endpoint

Expand Down Expand Up @@ -278,7 +280,7 @@ def __call__(self, query):
url = "http://%s/%s/search" % (self.endpoint, api_version)
params = query.to_params()

r = requests.get(url, params=params)
r = self.session.get(url, params=params)
try:
data = json.loads(r.content)
except ValueError, e:
Expand Down

0 comments on commit fb3a7b4

Please sign in to comment.