Permalink
Browse files

Hackish bug fix for hanging connections on large queries

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...
1 parent e4bbd17 commit fbc8b8984b044fc4256fe931737bf71e77ae9ade @stevearc stevearc committed Sep 7, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 momoko/pools.py
View
@@ -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:

0 comments on commit fbc8b89

Please sign in to comment.