Commit 9531c9cb authored by Julien Muchembled's avatar Julien Muchembled

client: drop now useless wrapper to log safely in poll thread during shutdown

Recent Python already catches exceptions due to garbage collection on exit.
parent e27358d1
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from logging import DEBUG, ERROR
from threading import Thread, enumerate as thread_enum from threading import Thread, enumerate as thread_enum
from neo.lib import logging from neo.lib import logging
from neo.lib.locking import Lock from neo.lib.locking import Lock
...@@ -30,23 +29,15 @@ class _ThreadedPoll(Thread): ...@@ -30,23 +29,15 @@ class _ThreadedPoll(Thread):
self.daemon = True self.daemon = True
def run(self): def run(self):
_log = logging.log logging.debug('Started %s', self)
def log(*args, **kw):
# Ignore errors due to garbage collection on exit
try:
_log(*args, **kw)
except Exception:
if not self.stopping:
raise
log(DEBUG, 'Started %s', self)
try: try:
while 1: while 1:
try: try:
self.em.poll(1) self.em.poll(1)
except Exception: except Exception:
log(ERROR, 'poll raised, retrying', exc_info=1) logging.error('poll raised, retrying', exc_info=1)
finally: finally:
log(DEBUG, 'Threaded poll stopped') logging.debug('Threaded poll stopped')
def stop(self): def stop(self):
self.stopping = True self.stopping = True
......
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