Skip to content

Commit

Permalink
Move conn transport check to ConnectionPool.put()
Browse files Browse the repository at this point in the history
Connection.return_to_pool() also goes through this method
  • Loading branch information
thobbs committed Jul 30, 2013
1 parent 8d664ba commit b54e637
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pycassa/pool.py
Expand Up @@ -66,8 +66,7 @@ def return_to_pool(self):
on the wrapper.
"""
if self.transport.isOpen():
self._pool.put(self)
self._pool.put(self)

def _checkin(self):
if self._state == ConnectionWrapper._IN_QUEUE:
Expand Down Expand Up @@ -479,6 +478,9 @@ def _clear_current(self):

def put(self, conn):
""" Returns a connection to the pool. """
if not conn.transport.isOpen():
return

if self._pool_threadlocal:
if hasattr(self._tlocal, 'current') and self._tlocal.current:
conn = self._tlocal.current
Expand Down

0 comments on commit b54e637

Please sign in to comment.