public override bool AddEvent(string eventKey, Topic topic)
{
lock (_lockObj)
{
// O(n), but small n and it's not common
var index = _cursors.FindIndex(c => c.Key == eventKey);
if (index == -1)
{
_cursors.Add(new Cursor
{
Key = eventKey,
Id = GetMessageId(topic)
});
_cursorTopics.Add(topic);
return true;
}
return false;
}
}