From 30212e27558e985fcba4e0319ca72c1ddf29720f Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Wed, 6 Jul 2016 11:55:50 -0700 Subject: [PATCH] This fixes a bug where we weren't locking the Python env. This lead to the `Text File Busy` errors, because we were trying to create the virtualenv while another process was running. Instead of this throwing a "version locked" error and retrying, it was just failing because it was never checking for a lock properly. --- readthedocs/projects/tasks.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 1a3fa2f6bfc..1f5954fae25 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -297,11 +297,15 @@ def setup_environment(self): """ self.build_env.update_build(state=BUILD_STATE_INSTALLING) - self.python_env.delete_existing_build_dir() - self.python_env.setup_base() - self.python_env.install_core_requirements() - self.python_env.install_user_requirements() - self.python_env.install_package() + with self.project.repo_nonblockinglock( + version=self.version, + max_lock_age=getattr(settings, 'REPO_LOCK_SECONDS', 30)): + + self.python_env.delete_existing_build_dir() + self.python_env.setup_base() + self.python_env.install_core_requirements() + self.python_env.install_user_requirements() + self.python_env.install_package() def build_docs(self): """Wrapper to all build functions