fix github spam
This commit is contained in:
parent
ea8ad39ac9
commit
9be4f0d55a
1 changed files with 9 additions and 12 deletions
|
@ -67,19 +67,16 @@ class MSCGetter(niobot.Module):
|
|||
found.append(data)
|
||||
|
||||
if len(found) < 10 or force_fetch:
|
||||
def get_first_page() -> list[dict]:
|
||||
paginated_list: PaginatedList = self.gh.search_issues(
|
||||
"presence",
|
||||
**{
|
||||
"is": "pull-request",
|
||||
"repo": "matrix-org/matrix-spec-proposals"
|
||||
try:
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.get(
|
||||
"https://api.github.com/search/issues",
|
||||
params={
|
||||
"q": "%s+is:pull-request+repo:matrix.org/matrix-spec-proposals" % query
|
||||
}
|
||||
)
|
||||
page: list[Issue] = paginated_list.get_page(0)
|
||||
return [x.raw_data for x in page]
|
||||
|
||||
try:
|
||||
issues = await asyncio.to_thread(get_first_page)
|
||||
response.raise_for_status()
|
||||
issues = response.json()["items"]
|
||||
except Exception:
|
||||
return [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue