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 = {}
|
||||
|
||||
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
|
||||
|
||||
def get_old_event(self, evt):
|
||||
"""
|
||||
get the previously registered event with the same path as 'evt'
|
||||
"""
|
||||
return self.store[ evt.path ]
|
||||
|
||||
def register(self, evt):
|
||||
|
|
|
@ -9,11 +9,11 @@ class EventDrainer(Loggable):
|
|||
"""
|
||||
def __init__(self, connection, interval=1):
|
||||
def cb():
|
||||
try: connection.drain_events(timeout=0.3)
|
||||
except socket.timeout: pass
|
||||
except Exception as e:
|
||||
self.logger.error("Error flushing events")
|
||||
self.logger.error( str(e) )
|
||||
t = RepeatTimer(interval, cb)
|
||||
try : connection.drain_events(timeout=0.3)
|
||||
except socket.timeout : pass
|
||||
except Exception as e :
|
||||
self.fatal_exception("Error flushing events", e)
|
||||
|
||||
t = RepeatTimer(interval, cb)
|
||||
t.daemon = True
|
||||
t.start()
|
||||
|
|
Loading…
Reference in New Issue