Continuously update set as messages are sent. This avoids expensive queries when building initial state. NOTE! This might have some bugs, I've only done initial testing.
@KenavR This is my proposed optimization for the active rooms situation. It has a couple major upsides:
Faster execution
I'm doing the removal of active rooms that you're in during the loop over your chat room joins that we execute during initial state building anyway, so it saves additional iteration of the joins which can be expensive.
Simpler code
It also has a couple downsides:
I'm not calculating a number of new messages for the active rooms, but I'm not sure that's critical. People are finding the red message count number distracting anyway.
I think the ranking might be off, I'm not sure I'm sorting this that correctly at the moment.
i'm sorry there's a lot of deleted code here, I just removed anything that didn't seem critical to this approach so I wasn't confused.
In terms of code structure, in addition to the changes needed for the stuff above, I've removed a few of those service objects and other extra classes. They don't seem to provide much value and make things a little harder to figure out when you're following the code. So in the future it'd be easier for me if we stuck to Controllers, Models, Json, Jobs, Util classes and stuff like that. Don't worry about it too much, but in general it's not usually that necessary to add a class.
Continuously update set as messages are sent. This avoids expensive queries when building initial state. NOTE! This might have some bugs, I've only done initial testing.
@KenavR This is my proposed optimization for the active rooms situation. It has a couple major upsides:
It also has a couple downsides:
i'm sorry there's a lot of deleted code here, I just removed anything that didn't seem critical to this approach so I wasn't confused.
In terms of code structure, in addition to the changes needed for the stuff above, I've removed a few of those service objects and other extra classes. They don't seem to provide much value and make things a little harder to figure out when you're following the code. So in the future it'd be easier for me if we stuck to Controllers, Models, Json, Jobs, Util classes and stuff like that. Don't worry about it too much, but in general it's not usually that necessary to add a class.