Skip to content
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

Mark a build as DUPLICATED (same version) only it's close in time #7420

Merged
merged 2 commits into from Sep 7, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions readthedocs/core/utils/__init__.py
Expand Up @@ -184,6 +184,7 @@ def prepare_build(
project=project,
version=version,
state=BUILD_STATE_TRIGGERED,
date__gte=timezone.now() - datetime.timedelta(minutes=5),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a comment explaining why 5 mins, or pointing to this PR.

Seems we could adjust this to be the normal build time length, but that would add some queries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on the comment.

Seems we could adjust this to be the normal build time length, but that would add some queries.

I thought about this, but using the build time of the project, you end up waiting 15 or more before being able to trigger a new build when there is a staled build. In the end, it's not too much different than our task finish_inactive_builds.

Oh, looking at that task it seems we changed the max time for a build to be considered stale to 2hs! It was DOCKER_LIMIT['time'] * 1.2 originally. I think we can revert this changes now that we have the right docker limits in the dictionary: #7029

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finish_inactive_builds doesn't stop the builds from happening on the builders, it just updates the status of the Build object. They are solving different problems.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but finish_inactive_builds is the task that "unblocks" the DEDUPLICATE_BUILDS feature flag to start working again (not marking all of them as duplicated) by updating the state to something different than triggered. Now, it's unblocking these builds after more than 2hs of stale.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. That makes sense.

).count() > 1

if not project.has_feature(Feature.DEDUPLICATE_BUILDS):
Expand Down