Chatmore
Chatmore copied to clipboard
Upgrade response handlers with a "worker" concept
The problem that can occur is when too much activity occurs in a short time. Such as: Lots of incoming messages received or when lots of messages have been received while the user was away and just returned, causing a large update of colorizing missed messages. This causes delays on the UI.
It would be cleaner to work these updates into smaller units of work and fed through a worker queue that processes the updates when it can without affecting response time.
Updates to console messages should be prioritized. e.g. If a response is received with, say, 50 messages, the worker units would update the most receive messages first. Meanwhile, older messages will be queued up and sent to the appropriate position of the console when time allows. This way, should many, many messages be received, the worker will try to always prioritized the newest messages first before working on the older messages.
Possible candidate tool: http://communistjs.com/