There is no ability to limit max number of resources for single occupant
I found there is no ability to limit max number of resources for single occupant.
It means a single occupant can join a particular room from unlimited devices by the same nickname.
With this issue I found the following bottlenecks in Tigase code:
1) When a user joins a room - we send a presence wrapper back to him containing all current available resources for this nickname. Every time we do a 'for' loop on unlimited resources here.
2) Every time a user joins/leaves room - we re-calculate the best presence for him
And we also do a 'while' loop on unlimited resources here.
What I propose (alternatives)
1) Introduce new room config: muc#roomconfig_maxresources and use it to limit the max number of single occupant's resources
2) Introduce new config to manage what we should send back to user when he joins a room: a presence wrapper with all current available resources of this nickname (what we have now) OR only current joining resource. E.g. we can do it as a part of PresenceModuleNoBroadcast class.
I propose to optimize a PresenceStore.intGetBestPresence method for a case when we use PREFERE_LAST. We can omit that 'while' loop because presence.lastUpdated is never changed. We can introduce a HashMap with the latest presence for each occupant and access it directly.
Thanks, let me know if it makes sense
Added by Bartosz Malkowski 8 months ago
I also made some optimization of
intGetBestPresence(). But your solution works only when new resource join to room. When one of resource leaves room I have to find previous "last presence" in classic way.
(code is not comited yet)