Skip to content

Commit

Permalink
Reduce max and default pagination offsets
Browse files Browse the repository at this point in the history
Reduce the maximum and default values for the `page[limit]` query param
to the paginated list-group-members API. The frontend isn't going to be
using values greater than 100 anyway, and we may as well get rid of the
slower requests that're created by larger page sizes.
  • Loading branch information
seanh committed Dec 5, 2024
1 parent a7c2181 commit 09ca2e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions h/schemas/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class PaginationQueryParamsSchema(Schema):
limit = SchemaNode(
Integer(),
name="page[limit]",
validator=Range(min=1, max=500),
missing=200,
validator=Range(min=1, max=100),
missing=20,
)
6 changes: 3 additions & 3 deletions tests/unit/h/schemas/pagination_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestPaginationQueryParamsSchema:
@pytest.mark.parametrize(
"input_,output",
[
({}, {"page[offset]": 0, "page[limit]": 200}),
({}, {"page[offset]": 0, "page[limit]": 20}),
(
{"page[offset]": 150, "page[limit]": 50},
{"page[offset]": 150, "page[limit]": 50},
Expand All @@ -31,8 +31,8 @@ def test_valid(self, schema, input_, output):
),
({"page[limit]": 0}, r"^page\[limit\]: 0 is less than minimum value 1$"),
(
{"page[limit]": 501},
r"^page\[limit\]: 501 is greater than maximum value 500$",
{"page[limit]": 101},
r"^page\[limit\]: 101 is greater than maximum value 100$",
),
(
{"page[offset]": "foo", "page[limit]": "bar"},
Expand Down

0 comments on commit 09ca2e4

Please sign in to comment.