Skip to content

Commit

Permalink
Merge pull request #57 from Jelloeater/fix/batching
Browse files Browse the repository at this point in the history
Fixed pagination
  • Loading branch information
Jelloeater authored Jul 27, 2024
2 parents f59c9bb + 4383769 commit c58ea81
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fedi_gatus/config_gen/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,21 @@ def generate_top_instances():
d = []
i = 0
page = 1
limit = int(os.getenv("NUMBER_OF_SERVERS")) if int(os.getenv("NUMBER_OF_SERVERS")) < 100 else 100
while True:
if i >= int(os.getenv("NUMBER_OF_SERVERS")):
if i > int(os.getenv("NUMBER_OF_SERVERS")):
d = d[: int(os.getenv("NUMBER_OF_SERVERS"))]
break
next = max(min(100, int(os.getenv("NUMBER_OF_SERVERS")) - i), 0)
i += next
i += limit
response = requests.get(
url="https://fediseer.com/api/v1/whitelist",
timeout=60,
params={
"endorsements": 1,
"guarantors": 1,
"software_csv": "lemmy",
"limit": next,
"limit": limit,
"page": page,
"domains": True,
},
Expand Down

0 comments on commit c58ea81

Please sign in to comment.