summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/PullEvents.py3
-rw-r--r--module/Utils.py18
2 files changed, 19 insertions, 2 deletions
diff --git a/module/PullEvents.py b/module/PullEvents.py
index 16566cfae..4f250d2f7 100644
--- a/module/PullEvents.py
+++ b/module/PullEvents.py
@@ -18,6 +18,7 @@
"""
from time import time
+from module.utils import uniqify
class PullManager():
def __init__(self, core):
@@ -45,7 +46,7 @@ class PullManager():
if not validUuid:
self.newClient(uuid)
events = [ReloadAllEvent("queue").toList(), ReloadAllEvent("collector").toList()]
- return events
+ return uniqify(events, repr)
def addEvent(self, event):
for client in self.clients:
diff --git a/module/Utils.py b/module/Utils.py
index b85f48210..de07a9450 100644
--- a/module/Utils.py
+++ b/module/Utils.py
@@ -42,5 +42,21 @@ def freeSpace(folder):
s = statvfs(folder)
return s.f_bsize * s.f_bavail / 1024 / 1024 #megabyte
+def uniqify(seq, idfun=None):
+ # order preserving
+ if idfun is None:
+ def idfun(x): return x
+ seen = {}
+ result = []
+ for item in seq:
+ marker = idfun(item)
+ # in old Python versions:
+ # if seen.has_key(marker)
+ # but in new ones:
+ if marker in seen: continue
+ seen[marker] = 1
+ result.append(item)
+ return result
+
if __name__ == "__main__":
- print freeSpace(".") \ No newline at end of file
+ print freeSpace(".")