Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Commit

Permalink
Hackish bug fix for hanging connections on large queries
Browse files Browse the repository at this point in the history
If the query is large, psycopg2 sets async status to WRITE and requires
additional calls to poll() to flush the query to postgresql.  Momoko was
telling tornado to only listen for READ, so poll() was never called and
the query would hang
  • Loading branch information
stevearc committed Sep 7, 2012
1 parent e4bbd17 commit fbc8b89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions momoko/pools.py
Expand Up @@ -318,8 +318,8 @@ def cursor(self, function, function_args, callback, cursor_kwargs={}):
getattr(cursor, function)(*function_args)
self._callbacks = [partial(callback, cursor)]

# Connection state should be 1 (write)
self._ioloop.update_handler(self._fileno, IOLoop.READ)
# Fire callback immediately To correctly set the update handler
self._io_callback(None, None)

def _io_callback(self, fd, events):
try:
Expand Down

0 comments on commit fbc8b89

Please sign in to comment.