fix github spam

This commit is contained in:
Nexus 2024-09-20 01:19:57 +01:00
parent ea8ad39ac9
commit 9be4f0d55a

View file

@ -67,19 +67,16 @@ class MSCGetter(niobot.Module):
found.append(data) found.append(data)
if len(found) < 10 or force_fetch: if len(found) < 10 or force_fetch:
def get_first_page() -> list[dict]: try:
paginated_list: PaginatedList = self.gh.search_issues( async with httpx.AsyncClient() as client:
"presence", response = await client.get(
**{ "https://api.github.com/search/issues",
"is": "pull-request", params={
"repo": "matrix-org/matrix-spec-proposals" "q": "%s+is:pull-request+repo:matrix.org/matrix-spec-proposals" % query
} }
) )
page: list[Issue] = paginated_list.get_page(0) response.raise_for_status()
return [x.raw_data for x in page] issues = response.json()["items"]
try:
issues = await asyncio.to_thread(get_first_page)
except Exception: except Exception:
return [ return [
{ {