diff options
| -rw-r--r-- | docs/api-usage-advanced.rst | 8 | ||||
| -rw-r--r-- | gitlab/client.py | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/docs/api-usage-advanced.rst b/docs/api-usage-advanced.rst index 2b069b8..256ae2d 100644 --- a/docs/api-usage-advanced.rst +++ b/docs/api-usage-advanced.rst @@ -123,9 +123,11 @@ GitLab server can sometimes return a transient HTTP error. python-gitlab can automatically retry in such case, when ``retry_transient_errors`` argument is set to ``True``. When enabled, HTTP error codes 500 (Internal Server Error), 502 (502 Bad Gateway), -503 (Service Unavailable), and 504 (Gateway Timeout) are retried. It will retry until reaching -the ``max_retries`` value. By default, ``retry_transient_errors`` is set to ``False`` and an exception -is raised for these errors. +503 (Service Unavailable), and 504 (Gateway Timeout) are retried. +Additionally the HTTP error code 409 (Conflict) is retried if the text message +mentions "Resource lock". It will retry until reaching the ``max_retries`` +value. By default, ``retry_transient_errors`` is set to ``False`` and an +exception is raised for these errors. .. code-block:: python diff --git a/gitlab/client.py b/gitlab/client.py index f558291..f9462ba 100644 --- a/gitlab/client.py +++ b/gitlab/client.py @@ -752,7 +752,10 @@ class Gitlab: return result.response if (429 == result.status_code and obey_rate_limit) or ( - result.status_code in gitlab.const.RETRYABLE_TRANSIENT_ERROR_CODES + ( + result.status_code in gitlab.const.RETRYABLE_TRANSIENT_ERROR_CODES + or (result.status_code == 409 and "Resource lock" in result.reason) + ) and retry_transient_errors ): # Response headers documentation: |
