[TASK] Add messages to queue only once.
This commit is contained in:
parent
c696b62c9b
commit
3f82e07b45
@ -65,7 +65,9 @@ class MonitorBotService(Service):
|
|||||||
path_segments = filepath.segmentsFrom(self._watch_path)
|
path_segments = filepath.segmentsFrom(self._watch_path)
|
||||||
new_path = '/'.join(path_segments)
|
new_path = '/'.join(path_segments)
|
||||||
msg = "ftp> /%s (%s)" % (new_path, ', '.join(humanReadableMask(mask)))
|
msg = "ftp> /%s (%s)" % (new_path, ', '.join(humanReadableMask(mask)))
|
||||||
self._messages.append(msg)
|
if msg not in self._messages:
|
||||||
|
self._messages.append(msg)
|
||||||
|
|
||||||
self._callid = reactor.callLater(5.0, sendQueuedMessages)
|
self._callid = reactor.callLater(5.0, sendQueuedMessages)
|
||||||
|
|
||||||
def sendQueuedMessages():
|
def sendQueuedMessages():
|
||||||
@ -75,6 +77,7 @@ class MonitorBotService(Service):
|
|||||||
else:
|
else:
|
||||||
for msg in self._messages:
|
for msg in self._messages:
|
||||||
self._bot.msg(self._channel, msg)
|
self._bot.msg(self._channel, msg)
|
||||||
|
self._messages = []
|
||||||
|
|
||||||
watchMask = ( inotify.IN_MODIFY
|
watchMask = ( inotify.IN_MODIFY
|
||||||
| inotify.IN_CREATE
|
| inotify.IN_CREATE
|
||||||
|
Loading…
Reference in New Issue
Block a user