Skip to content

Commit

Permalink
Improve cache utilization of pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
danlamanna committed Sep 11, 2024
1 parent 5c16a2c commit b8de447
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion isic/core/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def paginate_queryset(
# If we have an offset cursor then offset the entire page by that amount.
# We also always fetch an extra item in order to determine if there is a
# page following on from this one.
results = list(queryset[cursor.offset : cursor.offset + limit + 1])
# Always fetch the maximum page size to increase cache utilization.
results = list(queryset[cursor.offset : cursor.offset + self.max_page_size + 1])
page = list(results[:limit])

# Determine the position of the final item following the page.
Expand Down

0 comments on commit b8de447

Please sign in to comment.