I'm using python requests library with sessions:
def _get_session(self):
if not self.session:
self.session = requests.Session()
return self.session
And sometimes I'm getting this warning in my logs:
[2014/May/12 14:40:04 WARNING ] HttpConnectionPool is full, discarding connection: www.ebi.ac.uk
My question is: why this is warning and not an exception?
This is the code responsible for this (from http://pydoc.net/Python/requests/0.8.5/requests.packages.urllib3.connectionpool/):
def _put_conn(self, conn):
try:
self.pool.put(conn, block=False)
except Full:
# This should never happen if self.block == True
log.warning("HttpConnectionPool is full, discarding connection: %s"
% self.host)
Why this exception is catched here? If it was reraised, I could handle this exception in my code, by creating new session and deleting the old one.
If it's only a warning, does it mean it doesn't affect my results in any way? Can I ignore it? If not, how can I handle this situation?