Skip to content

Do not reset the build start time when running build env #6794

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

Merged
merged 1 commit into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion readthedocs/doc_builder/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ def __init__(
record=True,
environment=None,
update_on_success=True,
start_time=None,
):
super().__init__(project, environment)
self.version = version
Expand All @@ -557,7 +558,7 @@ def __init__(
self.update_on_success = update_on_success

self.failure = None
self.start_time = datetime.utcnow()
self.start_time = start_time or datetime.utcnow()

def __enter__(self):
return self
Expand Down
5 changes: 5 additions & 0 deletions readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ def __init__(
if config is not None:
self.config = config
self.task = task
self.build_start_time = None
# TODO: remove this
self.setup_env = None

Expand Down Expand Up @@ -577,6 +578,7 @@ def run_setup(self, record=True):
update_on_success=False,
environment=self.get_rtd_env_vars(),
)
self.build_start_time = environment.start_time

# TODO: Remove.
# There is code that still depends of this attribute
Expand Down Expand Up @@ -667,6 +669,9 @@ def run_build(self, record):
build=self.build,
record=record,
environment=env_vars,

# Pass ``start_time`` here to not reset the timer
start_time=self.build_start_time,
)

# Environment used for building code, usually with Docker
Expand Down