Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitlab params page and max_page either behave incorrectly or are not documented as expected #90

Closed
1 task
ColinFay opened this issue Jan 25, 2023 · 1 comment · Fixed by #118
Closed
1 task
Labels
bug Something isn't working

Comments

@ColinFay
Copy link
Member

ColinFay commented Jan 25, 2023

Validation

  •   When I use the param as documented, I'll get everything from GitLab

Tech

The doc for gitlab() states :

page: number of page of API response to get; if "all" (default),
          all pages (up to max_page parameter!) are queried
          successively and combined.

max_page: maximum number of pages to retrieve. Defaults to 10. This is
          an upper limit to prevent gitlabr getting stuck in retrieving
          an unexpectedly high number of entries (e.g. of a project
          list). It can be set to NA/Inf to retrieve all available
          pages without limit, but this is recommended only under
          controlled circumstances.

So we would expect page = "all", max_page = NA to return everything. But this is not what happens — I'll get more pages with the default params than with what page = "all", max_page = NA

> gitlab(
+   req = "projects",
+   verb = httr::GET,
+   page = "all",
+   max_page = NA
+ ) |> nrow()
[1] 20

versus :

> gitlab(
+   req = "projects",
+   verb = httr::GET
+ ) |> nrow()
[1] 200

and

gitlab(
  req = "projects",
  verb = httr::GET, 
  max_page = 100
) |> nrow()
[1] 476
@ColinFay
Copy link
Member Author

My short exploration leads to :

if (page == "all") {
  pages_retrieved <- 1L
  while (length(resp$nxt) > 0 && is.finite(max_page) &&  pages_retrieved < max_page) {

Given that

> is.finite(NA)
[1] FALSE

This should be why it stops here

@statnmap statnmap added bug Something isn't working labels May 15, 2024
@statnmap statnmap linked a pull request May 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants