-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync versions: use stable version instead of querying all versions #7380
Conversation
We are iterating over all versions just to get the current stable version, but we already have this information in the "stable" version. Tests needed to update the default version since some versions were created manually instead of calling the API as they normally do (we already have this for some tests).
Need to test this more locally. |
Local testing is looking good. |
old_highest_version = determine_stable_version(project.versions.all()) | ||
if old_highest_version is not None: | ||
activate_new_stable = old_highest_version.active | ||
current_stable = project.get_original_stable_version() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this checking for a new stable version (eg. the user has pushed a new higher version number), not getting it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is done in the code below
readthedocs.org/readthedocs/api/v2/views/model_views.py
Lines 242 to 260 in a387ac5
# TODO: move this to an automation rule | |
promoted_version = project.update_stable_version() | |
new_stable = project.get_stable_version() | |
if promoted_version and new_stable and new_stable.active: | |
log.info( | |
'Triggering new stable build: %(project)s:%(version)s', | |
{ | |
'project': project.slug, | |
'version': new_stable.identifier, | |
} | |
) | |
trigger_build(project=project, version=new_stable) | |
# Marking the tag that is considered the new stable version as | |
# active and building it if it was just added. | |
if ( | |
activate_new_stable and | |
promoted_version.slug in added_versions | |
): |
We just use this to get activate_new_stable
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me 👍
We are iterating over all versions just to get the current stable
version, but we already have this information in the "stable" version.
Tests needed to update the default version since
some versions were created manually instead of calling the API as they
normally do (we already have this for some tests).