Skip to content

Revert hotfix on rel/relcorp for build command patching, implement a proper fix from main #12331

@humitos

Description

@humitos

Diff between rel and main.

diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py
index 21d25dbb7..e933a60ca 100644
--- a/readthedocs/doc_builder/environments.py
+++ b/readthedocs/doc_builder/environments.py
@@ -16,7 +16,6 @@ from docker.errors import DockerException
 from docker.errors import NotFound as DockerNotFoundError
 from requests.exceptions import ConnectionError
 from requests.exceptions import ReadTimeout
-from slumber.exceptions import HttpNotFoundError
 
 from readthedocs.builds.models import BuildCommandResultMixin
 from readthedocs.core.utils import slugify
@@ -266,27 +265,15 @@ class BuildCommand(BuildCommandResultMixin):
             "start_time": self.start_time,
             "end_time": self.end_time,
         }
-        resp = None
 
         # If the command has an id, it means it has been saved before,
         # so we update it instead of creating a new one.
         if self.id:
             resp = api_client.command(self.id).patch(data)
         else:
-            if self.id:
-                try:
-                    resp = api_client.command(self.id).patch(data)
-                except HttpNotFoundError:
-                    # TODO don't do this, address builds restarting instead.
-                    # We try to post the buildcommand again as a temporary fix
-                    # for projects that restart the build process. There seems to be
-                    # something that causes a 404 during `patch()` in some biulds,
-                    # so we assume retrying `post()` for the build command is okay.
-                    log.exception("Build command has an id but doesn't exist in the database.")
-                    resp = api_client.command.post(data)
-            else:
-                resp = api_client.command.post(data)
-            log.debug("Response via JSON encoded data.", response=resp)
+            resp = api_client.command.post(data)
+
+        log.debug("Response via JSON encoded data.", response=resp)
 
         self.id = resp.get("id")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions