Skip to content

Conversation

@cdboer
Copy link
Collaborator

@cdboer cdboer commented May 27, 2021

Fixes #41.
Mentions #39 #42.

Changes proposed in this pull request:

  • Do not rely solely on the 'x-total-requests' key in HTTP response headers when paging through result pages.
  • Implement request queue, as the new pagination approach does not support creating all requests beforehand.
  • Add PyCharms ./idea directory to .gitignore
  • Add HTTP status handling for disabled project features (disabled git repository, disabled issues, disabled merge requests)
  • Add a default fallback in file history computation to suppress key errors

cdboer added 15 commits May 16, 2021 22:51
Rename GitlabAPIClient to GitlabClient
Export URL building into its own method in GitlabClient
Rework URL building, splitting path and query building into their own methods
Rename alru_cache to just cache as it does not represent an asynchronous least recently used cache and is used as a "one time store" cache
Add the ability to change the project path of the GitlabClient without having to reinstantiate the URLBuilder
Rely on the group_by function to sort results added to gitlab2prov/utils/__init__.py
The group_by function is used to match page results back to their appropriate request url's.

It is also used to regroup request results such as issue note awards.
For example: The GitlabClient is supposed to return a list of issue note awards for each issue of a project, but it can only request a list of awards for each issue note. To regroup the awards such that there is a list of awards for each issue and not for each issue note, one can use the group_by function and pass a group_size_index that reflects how many issue notes there are on each inbdividual issue.
Rewrite of RequestHandler:

Requests are now queued on demand.
Added pagination fallback to the key 'x-next-page' to not solely rely on 'x-total-pages'.
Add initial exception system, see TODO notes. Exceptions are supposed to be handled in the GitlabClient methods.
Makes it more obvious that the request queue does not hold request urls but rather request coroutines that have to be awaited to be executed. The queued coroutines are awaited in a asyncio.gather statement.
@cdboer cdboer merged commit d27f0f8 into master May 27, 2021
@cdboer cdboer deleted the api-client-refactoring branch May 27, 2021 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API client pagination - can't use 'x-total-pages' for GitLab.com

2 participants