posit-dev / posit-dev/connectapi

Paginated users requests makes one too many requests

Open
#224 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
54
Forks
27
Avg merge
1d 3m
Merged PRs (30d)
1

Description

The logic in the offset paginator is that it keeps requesting the next page until you get 0 results. This means that even if all results fit onto one page, you make two HTTP requests.

The paginated responses include a "total" value, so we can stop when we've accumulated that many results. Or, you could quit if the number of results you got back is less than the page size--that would overrequest in the case where the total number is an even multiple of the page size, but otherwise not.

This isn't a bug, the results are correct, it just makes it a little slower to get all users because you have an extra request to wait on.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the offset paginator entry point and trace how paginated responses are accumulated. Use the response's total value, or the returned page size, to identify when pagination can stop. Done means fetching all users without the unnecessary follow-up request while preserving the complete result set.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.