Improvements to mod_muc_room

ESL Developer Blog - - September 11, 2009

Because I am currently in the process of coupling mod_muc to our web-application-server I need to bind mod_muc to the permission-system that we have online (that is rewriting of mod_muc_room:get_affiliation/2 and :get_role/2.

During testing of the functionality i found, that these to functions are being called VERY often. I further looked into the case and found some instances where these functions are being called before passing some rather trivial checks (like whether the room is public or not). This was rather nasty because fetching a list of a few hundred rooms and then asking the role and affiliation for each room NINE times is pretty harsh on the web servers.

So I shifted some code around and was able to reduce the number of calls to these functions (for the “disco”-case) to TWO.
i stripped the code of all other modifications and it is included as an attachment to this post. Since i guess it is relevant how often you call the database with mnesia as well, I thought I’d share it. Code is “untested”, serves my purpose and should not be very error-prone, since it is basically just a refactoring of the functions handle_sync_event and process_iq_disco_items.

Get it here: mod_muc_room



Categories: Blogs  ESL Developer Blog  

Comments

No comments so far, you could be the first.

Add comment

Name:

Email:

URL:

Smileys

Remember my personal information

Notify me of follow-up comments?