Commit 9ee8d649 authored by Vincent Pelletier's avatar Vincent Pelletier

CMFActivity.Activity: Do not check message presence when registered.

This should never match, because published API does not provide access to
Message when registering it (this is intentional).
Also, this search is O(n), which makes activity creation complexity
O(n**2).
parent 1efc746c
...@@ -241,10 +241,7 @@ class Queue(object): ...@@ -241,10 +241,7 @@ class Queue(object):
return m in message_list return m in message_list
def registerMessage(self, activity_buffer, activity_tool, m): def registerMessage(self, activity_buffer, activity_tool, m):
message_list = activity_buffer.getMessageList(self) activity_buffer.getMessageList(self).append(m)
if m in message_list:
return
message_list.append(m)
m.is_registered = True m.is_registered = True
def unregisterMessage(self, activity_buffer, activity_tool, m): def unregisterMessage(self, activity_buffer, activity_tool, m):
......
...@@ -105,8 +105,7 @@ class SQLDict(SQLBase): ...@@ -105,8 +105,7 @@ class SQLDict(SQLBase):
if message_id in uid_set: if message_id in uid_set:
return return
uid_set.add(message_id) uid_set.add(message_id)
activity_buffer.getMessageList(self).append(m) super(SQLDict, self).registerMessage(activity_buffer, activity_tool, m)
m.is_registered = True
def unregisterMessage(self, activity_buffer, activity_tool, m): def unregisterMessage(self, activity_buffer, activity_tool, m):
m.is_registered = False # This prevents from inserting deleted messages into the queue m.is_registered = False # This prevents from inserting deleted messages into the queue
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment