cc-4105-2: added a separate thread to flush messages from kombu

This commit is contained in:
Rudi Grinberg 2012-07-27 15:38:09 -04:00
parent 7abe882455
commit 332e0f5080
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
import socket
from media.monitor.log import Loggable
from media.monitor.toucher import RepeatTimer
class EventDrainer(Loggable):
def __init__(self, connection, interval=1):
def cb():
try: connection.drain_events(timeout=0.1)
except socket.timeout: pass
except Exception as e:
self.logger.error("Error flushing events")
self.logger.error( str(e) )
t = RepeatTimer(interval, cb)
t.daemon = True
t.start()