Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[feature request] auto-retry when HTTP 409 Conflict: Resource lock is received #2325

Closed
@pspacek

Description

@pspacek

Description of the problem, including code/CLI snippet

Gitlab API requests can fail with errorConflict: 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 ashttps://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

Traceback (most recent call last):  File "/usr/lib/python3.10/site-packages/gitlab/exceptions.py", line 333, in wrapped_f    return f(*args, **kwargs)  File "/usr/lib/python3.10/site-packages/gitlab/v4/objects/jobs.py", line 32, in cancel    result = self.manager.gitlab.http_post(path, **kwargs)  File "/usr/lib/python3.10/site-packages/gitlab/client.py", line 1015, in http_post    result = self.http_request(  File "/usr/lib/python3.10/site-packages/gitlab/client.py", line 798, in http_request    raise gitlab.exceptions.GitlabHttpError(gitlab.exceptions.GitlabHttpError: 409: 409 Conflict: Resource lockThe above exception was the direct cause of the following exception:Traceback (most recent call last):  File "/home/pspacek/w/isc/gitlab/docs_test.py", line 99, in <module>    main()  File "/home/pspacek/w/isc/gitlab/docs_test.py", line 53, in main    proj.jobs.get(job.id, lazy=True).cancel()  File "/usr/lib/python3.10/site-packages/gitlab/cli.py", line 71, in wrapped_f    return f(*args, **kwargs)  File "/usr/lib/python3.10/site-packages/gitlab/exceptions.py", line 335, in wrapped_f    raise error(e.error_message, e.response_code, e.response_body) from egitlab.exceptions.GitlabJobCancelError: 409: 409 Conflict: Resource lock

Specifications

  • python-gitlab version: 3.10.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): gitlab.isc.org

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp