Skip to content

Commit dc98b58

Browse files
authored
Merge pull request #5788 from stsewd/get-version-from-api
Get version from the api
2 parents 63966d3 + c529b58 commit dc98b58

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

readthedocs/projects/tasks.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1387,11 +1387,12 @@ def warn(self, msg):
13871387

13881388
def clean_build(version_pk):
13891389
"""Clean the files used in the build of the given version."""
1390-
version = Version.objects.get_object_or_log(pk=version_pk)
1391-
if (
1392-
not version or
1393-
not version.project.has_feature(Feature.CLEAN_AFTER_BUILD)
1394-
):
1390+
try:
1391+
version = SyncRepositoryMixin.get_version(version_pk)
1392+
except Exception:
1393+
log.exception('Error while fetching the version from the api')
1394+
return False
1395+
if not version.project.has_feature(Feature.CLEAN_AFTER_BUILD):
13951396
log.info(
13961397
'Skipping build files deletetion for version: %s',
13971398
version_pk,

0 commit comments

Comments
 (0)