Description
The getSubscribers function in Page.py tests every user's permission to read the page in question, rather than only testing the permission of the users who actually are subscribed to the page. If the permission test is slow (in my case, it involves an LDAP query to a remote server) and there are many users, this can create a huge performance penalty on every non-trivial change to the wiki.
Steps to reproduce
- Have a wiki with 1400 registered users.
- Have a slow permission function (say, one requiring an LDAP lookup).
- Save a page to which no one subscribes.
- Wait a long time while the save completes.
Fix
Change page.py as follows (based on the current 1.5 code in Mercurial):
@@ -936,9 +936,7 @@ if not subscriber.email: continue # skip empty email addresses if trivial and not subscriber.want_trivial: continue # skip uninterested subscribers - if not UserPerms(subscriber).read(self.page_name): continue - - if subscriber.isSubscribedTo(pageList): + if subscriber.isSubscribedTo(pageList) and UserPerms(subscriber).read(self.page_name): lang = subscriber.language or request.cfg.language_default if not lang in subscriber_list: subscriber_list[lang] = []
This way, only users who are subscribed to the page have their permissions checked.
Plan
- Priority:
Assigned to: JohannesBerg
Status: fixed in 1.7: http://hg.moinmo.in/moin/1.7/rev/f048c3edc164