Skip to content

Commit

Permalink
Add sharedSession to prevent blocking session
Browse files Browse the repository at this point in the history
  • Loading branch information
madazone committed Apr 5, 2014
1 parent 9f9053e commit 28a4acf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion master/buildbot/steps/http.py
Expand Up @@ -67,11 +67,12 @@ class HTTPStep(BuildStep):
renderables = requestsParams
session = None

def __init__(self, url, method, description=None, descriptionDone=None, **kwargs):
def __init__(self, url, method, description=None, sharedSession=False, descriptionDone=None, **kwargs):
if txrequests is None or requests is None:
config.error("Need to install txrequest to use this step:\n\n pip install txrequests")
self.method = method
self.url = url
self.sharedSession = sharedSession
self.requestkwargs = {'method': method, 'url': url}
for p in HTTPStep.requestsParams:
v = kwargs.pop(p, None)
Expand Down Expand Up @@ -118,6 +119,10 @@ def doRequest(self):
log.addStderr('An exception occured while performing the request: %s' % e)
self.finished(FAILURE)
return
finally:
# close session if shared session is disabled
if not self.sharedSession:
closeSession()

if r.history:
log.addStdout('\nRedirected %d times:\n\n' % len(r.history))
Expand Down

0 comments on commit 28a4acf

Please sign in to comment.