Limit robots displayed in entity search
Before, we'd load *all* the robots, which can be a huge issue in namespaces with a large number of robots. Now, we only load the top-20 robots (as per recency in login), and we also limit the information returned to the entity search to save some bandwidth. Fixes https://jira.coreos.com/browse/QUAY-927
This commit is contained in:
parent
7878435805
commit
5c50161d85
7 changed files with 121 additions and 26 deletions
|
@ -410,7 +410,7 @@ def _list_entity_robots(entity_name, include_metadata=True):
|
|||
return query
|
||||
|
||||
|
||||
def list_entity_robot_permission_teams(entity_name, include_permissions=False):
|
||||
def list_entity_robot_permission_teams(entity_name, limit=None, include_permissions=False):
|
||||
query = (_list_entity_robots(entity_name))
|
||||
|
||||
fields = [User.username, User.creation_date, User.last_accessed, FederatedLogin.service_ident,
|
||||
|
@ -427,6 +427,7 @@ def list_entity_robot_permission_teams(entity_name, include_permissions=False):
|
|||
fields.append(Repository.name)
|
||||
fields.append(Team.name)
|
||||
|
||||
query = query.limit(limit).order_by(User.last_accessed.desc())
|
||||
return TupleSelector(query, fields)
|
||||
|
||||
|
||||
|
|
Reference in a new issue