After looking at bugs 353950 and 615654 and their oopses, it appears
that the two main causes of the timeouts are
TeamMembership._fillTeamParticipation() and
TeamMembership._sendStatusChangeNotification(), which sends emails to
all the members of a team individually if it does not have a preferred
email address.

The _sendStatusChangeNotification() method would be easy to batch, and
that would change the experience in the UI at all. However, the
_fillTeamParticipation() method is currently loading all the members
and submembers of a team and iterates over them, running a separate
query to check if the new superteam has an entry in the
TeamParticipation table and then inserting an entry by creating a
storm object that isn't going to be used after the insert. It seems
like even huge teams could be handled rather quickly with a query such
as:


INSERT INTO TeamParticipation (person, team)
SELECT Person, NEW_TEAM_ID
FROM TeamParticipation tp1
WHERE team = OLD_TEAM_ID
    AND NOT EXISTS (
        SELECT 1
        FROM TeamParticipation tp2
        WHERE tp2.person = tp1.person
            AND tp2.team = NEW_TEAM_ID
            );

Is there is any reason that this hasn't been done already? Also, is
there anything else that could be taking up a lot of time that is not
readily apparent from the oopses?

-Edwin

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to