cc-4105: added docstrings and fixed code formatting
This commit is contained in:
parent
a73d0940bd
commit
0b872afe59
|
@ -10,9 +10,16 @@ class EventContractor(Loggable):
|
||||||
self.store = {}
|
self.store = {}
|
||||||
|
|
||||||
def event_registered(self, evt):
|
def event_registered(self, evt):
|
||||||
|
"""
|
||||||
|
returns true if the event is registered which means that there is
|
||||||
|
another "unpacked" event somewhere out there with the same path
|
||||||
|
"""
|
||||||
return evt.path in self.store
|
return evt.path in self.store
|
||||||
|
|
||||||
def get_old_event(self, evt):
|
def get_old_event(self, evt):
|
||||||
|
"""
|
||||||
|
get the previously registered event with the same path as 'evt'
|
||||||
|
"""
|
||||||
return self.store[ evt.path ]
|
return self.store[ evt.path ]
|
||||||
|
|
||||||
def register(self, evt):
|
def register(self, evt):
|
||||||
|
|
|
@ -9,11 +9,11 @@ class EventDrainer(Loggable):
|
||||||
"""
|
"""
|
||||||
def __init__(self, connection, interval=1):
|
def __init__(self, connection, interval=1):
|
||||||
def cb():
|
def cb():
|
||||||
try: connection.drain_events(timeout=0.3)
|
try : connection.drain_events(timeout=0.3)
|
||||||
except socket.timeout: pass
|
except socket.timeout : pass
|
||||||
except Exception as e:
|
except Exception as e :
|
||||||
self.logger.error("Error flushing events")
|
self.fatal_exception("Error flushing events", e)
|
||||||
self.logger.error( str(e) )
|
|
||||||
t = RepeatTimer(interval, cb)
|
t = RepeatTimer(interval, cb)
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
|
|
Loading…
Reference in New Issue