Skip to content
Snippets Groups Projects
Commit 0a05dde5 authored by Gavin M. Roy's avatar Gavin M. Roy
Browse files

A better way to make sure the future doesnt already have an exception

parent 8caba67e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -8,7 +8,7 @@ The core `queries.Queries` class will automatically register support for UUIDs,
Unicode and Unicode arrays.
 
"""
__version__ = '1.8.3'
__version__ = '1.8.4'
version = __version__
 
import logging
Loading
Loading
Loading
Loading
@@ -444,12 +444,12 @@ class TornadoSession(session.Session):
state = self._connections[fd].poll()
except OSError as error:
self._ioloop.remove_handler(fd)
if not self._futures[fd].exception():
if fd in self._futures and not self._futures[fd].done():
self._futures[fd].set_exception(
psycopg2.OperationalError('Connection error (%s)' % error)
)
except (psycopg2.Error, psycopg2.Warning) as error:
if not self._futures[fd].exception():
if fd in self._futures and not self._futures[fd].done():
self._futures[fd].set_exception(error)
else:
if state == extensions.POLL_OK:
Loading
Loading
@@ -461,7 +461,7 @@ class TornadoSession(session.Session):
self._ioloop.update_handler(fd, ioloop.IOLoop.READ)
elif state == extensions.POLL_ERROR:
self._ioloop.remove_handler(fd)
if not self._futures[fd].exception():
if fd in self._futures and not self._futures[fd].done():
self._futures[fd].set_exception(
psycopg2.Error('Poll Error'))
 
Loading
Loading
Loading
Loading
@@ -29,7 +29,7 @@ classifiers = ['Development Status :: 5 - Production/Stable',
'Topic :: Software Development :: Libraries']
 
setup(name='queries',
version='1.8.3',
version='1.8.4',
description="Simplified PostgreSQL client built upon Psycopg2",
maintainer="Gavin M. Roy",
maintainer_email="gavinmroy@gmail.com",
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment