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

Incr counters in TornadoSession

parent 5b1530d6
No related branches found
No related tags found
No related merge requests found
Version History
===============
 
2.0.0 2018-01-23
2.0.0 2018-01-29
-----------------
- REMOVED support for Python 2.6
- FIXED CPU Pegging bug: Cleanup IOLoop and internal stack in ``TornadoSession``
Loading
Loading
@@ -36,9 +36,9 @@ Version History
 
1.10.0 2017-09-27
-----------------
- Free when tornado_session.Result is ``__del__'d`` without ``free`` being called.
- Free when tornado_session.Result is ``__del__``'d without ``free`` being called.
- Auto-clean the pool after Results.free TTL+1 in tornado_session.TornadoSession
- Dont raise NotImplementedError in Results.free for synchronous use, just treat as a noop
- Don't raise NotImplementedError in Results.free for synchronous use, just treat as a noop
 
1.9.1 2016-10-25
----------------
Loading
Loading
Loading
Loading
@@ -372,11 +372,13 @@ class TornadoSession(session.Session):
def completed(qf):
"""Invoked by the IOLoop when the future has completed"""
if qf.exception():
self._incr_exceptions(conn)
err = qf.exception()
LOGGER.debug('Cleaning cursor due to exception: %r', err)
self._exec_cleanup(cursor, conn.fileno())
future.set_exception(err)
else:
self._incr_executions(conn)
value = Results(cursor, self._exec_cleanup, conn.fileno())
future.set_result(value)
 
Loading
Loading
@@ -446,6 +448,22 @@ class TornadoSession(session.Session):
if fd in self._futures:
del self._futures[fd]
 
def _incr_exceptions(self, conn):
"""Increment the number of exceptions for the current connection.
:param psycopg2.extensions.connection conn: the psycopg2 connection
"""
self._pool_manager.get_connection(self.pid, conn).exceptions += 1
def _incr_executions(self, conn):
"""Increment the number of executions for the current connection.
:param psycopg2.extensions.connection conn: the psycopg2 connection
"""
self._pool_manager.get_connection(self.pid, conn).executions += 1
def _on_io_events(self, fd=None, _events=None):
"""Invoked by Tornado's IOLoop when there are events for the fd
 
Loading
Loading
Loading
Loading
@@ -2,5 +2,4 @@ coverage
flake8
mock
nose
codecov
tornado
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