project.protectedbranches.delete 404: 404 Not found #2536
-
|
I have a script I've written that creates/configures a gitlab project. After creating the project, the script does a "project.protectedbranches.delete('work')". 'work' is our default branch so it will always exist and is a protected branch. About half the time I make this call, I get the following callback. Is there some server/client timing that I need to be aware of? If so, is there a way to query to know that it is safe to delete the protections? Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): python: 3.7.9 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hey @jalanh11640! It's hard to say without seeing your code. But yes, GitLab does a lot of things asynchronously these days, which can take some time especially with things like creating the initial repository, branches, merge requests etc. Try with a simple sleep first, maybe a few seconds, and if that works you can then do it in a smarter loop until success or so. There's no harm in just putting this into try/except blocks until the resource is available to make requests against. It'll be fewer API calls than trying to query the state of the project. |
Beta Was this translation helpful? Give feedback.
Hey @jalanh11640! It's hard to say without seeing your code.
But yes, GitLab does a lot of things asynchronously these days, which can take some time especially with things like creating the initial repository, branches, merge requests etc. Try with a simple sleep first, maybe a few seconds, and if that works you can then do it in a smarter loop until success or so.
There's no harm in just putting this into try/except blocks until the resource is available to make requests against. It'll be fewer API calls than trying to query the state of the project.