Skip to content

Commit

Permalink
fix connection pool check_close_callback
Browse files Browse the repository at this point in the history
  • Loading branch information
snower committed Oct 16, 2015
1 parent 7d52c2d commit c18a32f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tormysql/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def check_close_callback(self):
self._check_close_callback = False
for connection in list(self._connections):
if connection.open:
connection._handle_read()
connection.socket._handle_read()

def connection_close_callback(self, connection):
try:
Expand All @@ -180,10 +180,9 @@ def connection_close_callback(self, connection):
except ValueError:
logging.warning("Close unknown Connection %s", connection)
if self._close_future and not self._used_connections and not self._connections:
def do_close():
self._close_future.set_result(None)
self._close_future = None
IOLoop.current().add_callback(do_close)
close_future = self._close_future
IOLoop.current().add_callback(close_future.set_result, None)
self._close_future = None

if not self._check_close_callback:
IOLoop.current().add_callback(self.check_close_callback)
Expand Down

0 comments on commit c18a32f

Please # to comment.