cc-4105-2: added a separate thread to flush messages from kombu
This commit is contained in:
parent
7abe882455
commit
332e0f5080
|
@ -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()
|
Loading…
Reference in New Issue