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
[feature request] auto-retry when HTTP 409 Conflict: Resource lock is received #2325
Comments
Thanks for the report @pspacek. A simple retry on 409 would be pretty trivial to add, we just need to extend the list of retryable response codes: python-gitlab/gitlab/client.py Line 25 in bcc1eb4
We already have a backoff mechanism in place for the existing ones, so I wouldn't try anything more custom unless you find more issues. But looking at this again, not every 409 response warrants a retry. If we can reliably inspect the message ( python-gitlab/gitlab/client.py Lines 766 to 769 in bcc1eb4
A quick search for https://gitlab.com/search?search=409&nav_source=navbar&project_id=278964&group_id=9970&search_code=true&repository_ref=master can give us some clues perhaps. Would you be interested in opening a PR yourself @pspacek? We have hacktoberfest enabled on this repo. |
You are right, most of HTTP 409 do not warrant retry. From a causal browse through Gitlab sources I think we should go for only for "Resource lock" and add others only later if we find any - I did not notice anything else. As for PR, sure, let me give it a stab. |
Sounds great @pspacek. If the conditional gets too unwieldy we can factor it out into a |
I was thinking that I can reuse test_http_request_with_retry_on_method_for_transient_failures() test, but there is a catch: I cannot see a documented way for Do you have a preferred hack for this? |
@pspacek I've answered in the PR :) I think |
Description of the problem, including code/CLI snippet
Gitlab API requests can fail with error
Conflict: Resource lock
, and it is tedious to write retry loop around all call sites.I propose to add an (optional?) feature to auto-retry API calls which fail with this particular error.
In my opinion this is the same case as https://peps.python.org/pep-0475/ .
I'm happy to discuss details like retry limit etc. Thank you for considering this.
Expected Behavior
API calls are automatically retried when server replies with "HTTP 409 Conflict: Resource lock".
Actual Behavior
Specifications
The text was updated successfully, but these errors were encountered: