From b0b1debaa9f4ed15ad3e14e8b8ce037ce32b1ee0 Mon Sep 17 00:00:00 2001 From: Jakub Stasiak Date: Mon, 3 Aug 2015 10:51:37 +0200 Subject: Ignore RuntimeErrors together with socket errors When Python's standard library is patched with Eventlet the exception raised when two threads access the same socket simultaneously is RuntimeError and I think it makes sense to include it here. The downside is it may start ignoring too wide variety of exceptions but on the other hand I can't think of any other RuntimeErrors that can be raised here. --- statsd/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statsd/client.py b/statsd/client.py index 73e7712..357597a 100644 --- a/statsd/client.py +++ b/statsd/client.py @@ -146,7 +146,7 @@ class StatsClient(StatsClientBase): """Send data to statsd.""" try: self._sock.sendto(data.encode('ascii'), self._addr) - except socket.error: + except (socket.error, RuntimeError): # No time for love, Dr. Jones! pass -- cgit v1.2.1