Skip to content

Commit

Permalink
Update build from database at __exit__ (#3292)
Browse files Browse the repository at this point in the history
* Update build from database at __exit__

When an exception happens and it's handled by __exit__ our Build in
the database is not updated and it stay in 'Installing' forever. So,
when something bad happens we force a call to `update_build` with the
FINISHED state

Attempt to fix #3285

* `update_build` when FINISHED in the right place
  • Loading branch information
humitos authored and agjohnson committed Nov 22, 2017
1 parent d6eac0e commit 3e1651e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ private_*
readthedocs/htmlcov
tags
.python-version
*.pyo
3 changes: 3 additions & 0 deletions readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def run_setup(self, record=True):
if not isinstance(self.setup_env.failure, vcs_support_utils.LockTimeout):
self.send_notifications()

self.setup_env.update_build(state=BUILD_STATE_FINISHED)
return False

if self.setup_env.successful and not self.project.has_valid_clone:
Expand Down Expand Up @@ -257,6 +258,8 @@ def run_build(self, docker=False, record=True):

if self.build_env.failed:
self.send_notifications()

self.build_env.update_build(state=BUILD_STATE_FINISHED)
build_complete.send(sender=Build, build=self.build_env.build)

@staticmethod
Expand Down

0 comments on commit 3e1651e

Please sign in to comment.