prevent duplicate entries in the datastore

This commit is contained in:
Jack Robison 2018-05-23 17:33:22 -04:00
parent 23c202b5e4
commit e5703833cf
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -40,7 +40,8 @@ class DictDataStore(UserDict.DictMixin):
def addPeerToBlob(self, key, value, lastPublished, originallyPublished, originalPublisherID):
if key in self._dict:
self._dict[key].append((value, lastPublished, originallyPublished, originalPublisherID))
if value not in map(lambda store_tuple: store_tuple[0], self._dict[key]):
self._dict[key].append((value, lastPublished, originallyPublished, originalPublisherID))
else:
self._dict[key] = [(value, lastPublished, originallyPublished, originalPublisherID)]