You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the problem, including code/CLI snippet
I tried to emulate Githubs dynamic Badges using Apache, mod_python and python-gitlab. However, the building of a badge - for example showing the number of closed issues - is almost unbearably slow even when there are only 100 or so - using the naive approach to call list ant then count the returned elements (https://gist.github.com/elbosso/4f3bb0fb95dd1dc499cd46db422900bf).
However - the Gitlab API offers a possibility to count Objects - you simply have to do a fetch operation with pagination and setting the per_page parameter to 1 - the list operation still gives you a result and in that result there is the header X-Total - telling the total number of matching items for the given query. So we have an operation counting items matching a query that runs in constant time.
Thank you very much - i did not see this in the documentation and dove head over heels into the api examples where this was not mentioned. It is exactly what i was looking for: my dynamic badges are now using as_list and the performance is marvelous. Thanks again - I am closing this issue now...
Description of the problem, including code/CLI snippet
I tried to emulate Githubs dynamic Badges using Apache, mod_python and python-gitlab. However, the building of a badge - for example showing the number of closed issues - is almost unbearably slow even when there are only 100 or so - using the naive approach to call list ant then count the returned elements (https://gist.github.com/elbosso/4f3bb0fb95dd1dc499cd46db422900bf).
However - the Gitlab API offers a possibility to count Objects - you simply have to do a fetch operation with pagination and setting the per_page parameter to 1 - the list operation still gives you a result and in that result there is the header X-Total - telling the total number of matching items for the given query. So we have an operation counting items matching a query that runs in constant time.
Example with curl:
Expected Behavior
It would be nice if this kind of behaviour could be somehow added - maybe as add-on to the CRUD-Mixin?
I think, one would only need to support the v4 API here
Thanks for considering this - regards,
Juergen Key
The text was updated successfully, but these errors were encountered: