Log repr() of error because it's more conscience which makes it easier to
read the logs: in case of "e" there's additional
"Failure instance: Traceback (failure with no frames)" prefix which is
pretty useless because we won't have proper tracebacks for deferred anyway.
Change-Id: I39870b83cacee9a589636974d04e356ef0d32345
d.addCallback(collect,partial(handle_reply,ts,par['bsc_id'],f_write,f_log))# treq's collect helper is handy to get all reply content at once
d.addErrback(lambdae:f_log.critical("HTTP POST error %s while trying to register BSC %s on %s (timeout %d)"%(e,par['bsc_id'],dst,tout)))# handle HTTP errors
d.addErrback(lambdae:f_log.critical("HTTP POST error %s while trying to register BSC %s on %s (timeout %d)"%(repr(e),par['bsc_id'],dst,tout)))# handle HTTP errors
d.addCallback(collect,partial(handle_reply,ctx.process_reply,params['bsc_id'],self.transport.write,self.factory.log))# treq's collect helper is handy to get all reply content at once using closure on ctx
d.addErrback(lambdae,bsc:self.factory.log.critical("HTTP POST error %s while trying to register BSC %s on %s"%(e,bsc,self.factory.location)),bsc)# handle HTTP errors
d.addErrback(lambdae,bsc:self.factory.log.critical("HTTP POST error %s while trying to register BSC %s on %s"%(repr(e),bsc,self.factory.location)),bsc)# handle HTTP errors
# Ensure that we run only limited number of requests in parallel:
yieldself.factory.semaphore.acquire()
yieldd# we end up here only if semaphore is available which means it's ok to fire the request without exceeding the limit