Call lock per task
This lock was being shared by sync_repo and build_docs,
I'm moving it to the top of the tasks instead.
@@ -133,7 +133,6 @@ class SyncRepositoryMixin:
),
)
- with self.project.repo_nonblockinglock(version=self.version):
# Get the actual code on disk
try:
before_vcs.send(sender=self.version)
@@ -242,6 +241,7 @@ class SyncRepositoryTaskStep(SyncRepositoryMixin):
try:
self.version = self.get_version(version_pk=version_pk)
self.project = self.version.project
+ with self.project.repo_nonblockinglock(version=self.version):
self.sync_repo()
return True
except RepositoryError:
@@ -442,6 +442,7 @@ class UpdateDocsTaskStep(SyncRepositoryMixin):
if self.project.skip:
raise ProjectBuildsSkippedError
try:
+ with self.project.repo_nonblockinglock(version=self.version):
self.setup_vcs()
except vcs_support_utils.LockTimeout as e:
self.task.retry(exc=e, throw=False)
@@ -628,14 +629,6 @@ class UpdateDocsTaskStep(SyncRepositoryMixin):
log.warning('There was an error with the repository', exc_info=True)
# Re raise the exception to stop the build at this point
raise
- except vcs_support_utils.LockTimeout:
- log.info(
- 'Lock still active: project=%s version=%s',
- self.project.slug,
- self.version.slug,
- )
- # Raise the proper exception (won't be sent to Sentry)
- raise VersionLockedError
except Exception:
# Catch unhandled errors when syncing
log.exception(
