Comments (4)
@Ncoder2 I'm a bit surprised as we use python-gitlab for multiple long-running services that iterate over hundreds of thousands of projects and users on a weekly basis, and haven't seen issues. Do you have some results you could share?
Is there a reason to instantiate the client in every iteration instead of just once?
from python-gitlab.
@nejch , Thanks for the quick response, i just changed the above example code and tried to keep the Gitlab object creation out of the loop and the consumption has reduced. However, our use case is again to get project details of all projects using the gitlab client and take necessary actions/perform code scan etc.
We are using the gitlab client in a fastapi server, when we run a scan on say 1000s of projects, somehow the projects.get increases the memory the fastapi server restarts. In our code, we dont instantiate the gitlab object everytime though.
from python-gitlab.
HI @nejch , what would you suggest for this usecase:
The gitlab client is used as part of a fastapi service, where we retrieve project information based on project id for every request and these requests can be concurrent.
Solution 1:
- Create a gitlab object by providing credentials as a class level variable, but create different project details object for every request, please note, gitlab object remains the same, but gitlab project details object is created for every request
Solution 2:
- For every request, create a new gitlab object and project details object
Asking the two solutions to understand how would gitlab object behave when concurrent requests are made, gitlab project details object is created from the same gitlab object
from python-gitlab.
Related Issues (20)
- How do I differentiate between "405 Method Not Allowed" due to the source branch not being updated or due to conflicts? HOT 1
- API for get and add MR to merge train is missing HOT 4
- Add support for `retry_transient_errors` to then CLI
- Unable to initialize repo with readme when creating project on behalf of user HOT 1
- Merge request note update appends instead of replaces HOT 2
- CI: codecov failing at project level HOT 5
- Redirected `head()` requests raise `RedirectError` HOT 3
- GitLab mirror of python-gitlab is out of date HOT 5
- Improve download files from artifacts HOT 3
- Namespace Error / Namespace Ignored HOT 9
- Cant get ProjectRegistryRepository size HOT 4
- Support the approvalrules option "applies_to_all_protected_branches" HOT 3
- CLI: For `list` actions the CLI defaults to `get_all=False`
- gitlab merge request participants list HOT 2
- Should the participants method use `http_list`?
- .play() on job returns 500 even though job is started successfully HOT 6
- Trigger a test project hook
- Add support for testing/triggering Project and Group hooks HOT 2
- Add support for removing avatars in the topics API. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-gitlab.