Since the check for unique messages is in the main event loop, but the actual addition of the message is in a $timeout(...), sometimes I have as many as three of the same message get added to the list, since the first two $timeouts(...) did not trigger in time.
I'm not sure why there is a $timeout(...) in addMessage to begin with, but if there's a reason for it, then should the check for uniqueMessages be moved to within addMessage itself?
Since the check for unique messages is in the main event loop, but the actual addition of the message is in a $timeout(...), sometimes I have as many as three of the same message get added to the list, since the first two $timeouts(...) did not trigger in time.
I'm not sure why there is a $timeout(...) in addMessage to begin with, but if there's a reason for it, then should the check for uniqueMessages be moved to within addMessage itself?