ktrysmt/go-bitbucket

Support For Limiting Auto-Pagination Depth

tyler-domitrovich opened this issue · 5 comments

It would be nice to be able to limit how many pages of results are returned. Consider the case where we want to retrieve the most recent 20 commits for the main branch of a very active repository. Currently, the auto-pagination will recurse through all pages of results which is time consuming and unnecessary since we would have all of the results we require for this example after the first couple of pages.

FYI I was able to get a rough pass of this behavior working in my fork here:

https://github.com/tyler-domitrovich/go-bitbucket/tree/adjustable-pagination-depth

If you have any interest in this feature let me know and I will create a PR!

I don't believe so. It looks like DEFAULT_PAGE_LENGTH is used to set pagelen, which does allow us to change the number of results returned per page, but does not allow us to change the number of pages returned so we still will recurse through every page of results available.

Certainly. If you have a large number of pages, it may be important to limit the number of pages.
By the way, POC smells a little buggy. I think we can make the changes a little smaller.

Certainly. If you have a large number of pages, it may be important to limit the number of pages. By the way, POC smells a little buggy. I think we can make the changes a little smaller.

Hello!

Maybe we can be use my PR for this issue?

it small and won't break the old code

#199