Commit f9a9442b authored by Vincent Pelletier's avatar Vincent Pelletier

Add a class-level reference to logging module.

This makes garbage collector delay logging module deletion upon interpreter
shutdown, preventing occasional tracebacks from epoll thread.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1579 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 137e2908
...@@ -21,6 +21,11 @@ from neo import logging ...@@ -21,6 +21,11 @@ from neo import logging
class ThreadedPoll(Thread): class ThreadedPoll(Thread):
"""Polling thread.""" """Polling thread."""
# Garbage collector hint:
# Prevent logging module from being garbage-collected as it is needed for
# run method to cleanly exit.
logging = logging
def __init__(self, em, **kw): def __init__(self, em, **kw):
Thread.__init__(self, **kw) Thread.__init__(self, **kw)
self.em = em self.em = em
...@@ -34,8 +39,8 @@ class ThreadedPoll(Thread): ...@@ -34,8 +39,8 @@ class ThreadedPoll(Thread):
try: try:
self.em.poll() self.em.poll()
except: except:
logging.error('poll raised, retrying', exc_info=1) self.logging.error('poll raised, retrying', exc_info=1)
logging.debug('Threaded poll stopped') self.logging.debug('Threaded poll stopped')
def stop(self): def stop(self):
self._stop.set() self._stop.set()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment