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):
return m in message_list
def registerMessage(self, activity_buffer, activity_tool, m):
message_list = activity_buffer.getMessageList(self)
if m in message_list:
return
message_list.append(m)
activity_buffer.getMessageList(self).append(m)
m.is_registered = True
def unregisterMessage(self, activity_buffer, activity_tool, m):
......
......@@ -105,8 +105,7 @@ class SQLDict(SQLBase):
if message_id in uid_set:
return
uid_set.add(message_id)
activity_buffer.getMessageList(self).append(m)
m.is_registered = True
super(SQLDict, self).registerMessage(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
......
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