Skip to content

Commit ac40064

Browse files
committed
Don't use signal
1 parent 6d6bba4 commit ac40064

2 files changed

Lines changed: 5 additions & 18 deletions

File tree

readthedocs/builds/signals_receivers.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,3 @@ def update_latest_build_for_project(sender, instance, created, **kwargs):
2222
Project.objects.filter(pk=instance.project_id).update(
2323
latest_build=instance,
2424
)
25-
26-
27-
# TODO: this should be moved to an API call done after the build is completed.
28-
@receiver(post_save, sender=Build)
29-
def update_is_uploaded_for_version(sender, instance, created, **kwargs):
30-
"""
31-
When a successful build via the upload API is completed, update the version.
32-
33-
.. note::
34-
35-
This isn't 100% accurate, as an old build could be saved again,
36-
and the version would be marked as uploaded even if the latest build isn't uploaded.
37-
"""
38-
build = instance
39-
if build.version and build.finished and build.success and build.is_uploaded:
40-
version = instance.version
41-
version.is_uploaded = True
42-
version.save(update_fields=["is_uploaded"])

readthedocs/builds/tasks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,11 @@ def run_post_build_tasks(build_pk):
798798
)
799799

800800
if build.success:
801+
if build.is_uploaded and build.version:
802+
version = build.version
803+
version.is_uploaded = True
804+
version.save(update_fields=["is_uploaded"])
805+
801806
index_build.delay(build_id=build.pk)
802807

803808
if "readthedocsext.spamfighting" in settings.INSTALLED_APPS:

0 commit comments

Comments
 (0)