← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~lgp171188/launchpad:fix-optimize-has-any-bug-role-bulk-team-membership-checks into launchpad:master

 


Diff comments:

> diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
> index 7d4950e..09e1bca 100644
> --- a/lib/lp/registry/model/person.py
> +++ b/lib/lp/registry/model/person.py
> @@ -1347,10 +1347,13 @@ class Person(
>          if not teams:
>              return False
>  
> -        team_ids = {team.id for team in teams if team.is_team}
> -        if self.id in team_ids:
> -            # A team is always a member of itself.
> -            return True
> +        team_ids = set()
> +        for team in teams:

I converted the set comprehension into a 'for' loop to avoid iterating over the list of teams multiple times.

> +            if self.id == team.id:
> +                # A team is always a member of itself
> +                return True
> +            if team.is_team:
> +                team_ids.add(team.id)
>  
>          if self._inTeam_cache is None:
>              # Initialize cache


-- 
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/413792
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:fix-optimize-has-any-bug-role-bulk-team-membership-checks into launchpad:master.



References