Skip to content

Commit ce0948f

Browse files
authored
Merge pull request #4804 from rtfd/humitos/lock/appropiate-log
Appropiate logging when a LockTimeout for VCS is reached
2 parents c9b25c4 + fa3ce4c commit ce0948f

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

readthedocs/projects/tasks.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
from .constants import LOG_TEMPLATE
5858
from .exceptions import RepositoryError
59-
from .models import Domain, Feature, ImportedFile, Project
59+
from .models import Domain, ImportedFile, Project
6060
from .signals import (
6161
after_build, after_vcs, before_build, before_vcs, files_changed)
6262

@@ -219,10 +219,24 @@ def run(self, version_pk): # pylint: disable=arguments-differ
219219
except RepositoryError:
220220
# Do not log as ERROR handled exceptions
221221
log.warning('There was an error with the repository', exc_info=True)
222+
except vcs_support_utils.LockTimeout:
223+
log.info(
224+
'Lock still active: project=%s version=%s',
225+
self.project.slug,
226+
self.version.slug,
227+
)
222228
except Exception:
223229
# Catch unhandled errors when syncing
224230
log.exception(
225231
'An unhandled exception was raised during VCS syncing',
232+
extra={
233+
'stack': True,
234+
'tags': {
235+
'project': self.project.slug,
236+
'version': self.version.slug,
237+
},
238+
},
239+
226240
)
227241
return False
228242

@@ -557,7 +571,31 @@ def setup_vcs(self):
557571
version=self.version.slug,
558572
msg='Updating docs from VCS',
559573
))
560-
self.sync_repo()
574+
try:
575+
self.sync_repo()
576+
except RepositoryError:
577+
# Do not log as ERROR handled exceptions
578+
log.warning('There was an error with the repository', exc_info=True)
579+
except vcs_support_utils.LockTimeout:
580+
log.info(
581+
'Lock still active: project=%s version=%s',
582+
self.project.slug,
583+
self.version.slug,
584+
)
585+
except Exception:
586+
# Catch unhandled errors when syncing
587+
log.exception(
588+
'An unhandled exception was raised during VCS syncing',
589+
extra={
590+
'stack': True,
591+
'tags': {
592+
'build': self.build['id'],
593+
'project': self.project.slug,
594+
'version': self.version.slug,
595+
},
596+
},
597+
)
598+
561599
commit = self.project.vcs_repo(self.version.slug).commit
562600
if commit:
563601
self.build['commit'] = commit

0 commit comments

Comments
 (0)