From 19d25e74a549616f4ad628ef4d9a2b5b3f725620 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Fri, 10 May 2024 17:18:30 +0100 Subject: Warn when the max number of members per page is returned by Github's API. This is so that we know when it's time to implement paginated fetching of these members. --- arthur/apis/github/teams.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'arthur/apis/github/teams.py') diff --git a/arthur/apis/github/teams.py b/arthur/apis/github/teams.py index c16e2d9..4cf18d4 100644 --- a/arthur/apis/github/teams.py +++ b/arthur/apis/github/teams.py @@ -1,6 +1,7 @@ import aiohttp from arthur.config import CONFIG +from arthur.log import logger HEADERS = { "Accept": "application/vnd.github+json", @@ -21,4 +22,11 @@ async def list_team_members(team_slug: str, session: aiohttp.ClientSession) -> l params = {"per_page": MEMBERS_PER_PAGE} async with session.get(endpoint, headers=HEADERS, params=params) as response: response.raise_for_status() - return await response.json() + teams_resp = await response.json() + if len(teams_resp) == MEMBERS_PER_PAGE: + logger.warning( + "Max number (%d) of members returned when fetching members of %s. Some members may have been missed.", + MEMBERS_PER_PAGE, + team_slug, + ) + return teams_resp -- cgit v1.2.3