Skip to content

Commit e0c8405

Browse files
committed
Appropiate logging when a LockTimeout for VCS is reached
1 parent 7b47841 commit e0c8405

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
@@ -55,7 +55,7 @@
5555

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

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

@@ -548,7 +562,31 @@ def setup_vcs(self):
548562
version=self.version.slug,
549563
msg='Updating docs from VCS',
550564
))
551-
self.sync_repo()
565+
try:
566+
self.sync_repo()
567+
except RepositoryError:
568+
# Do not log as ERROR handled exceptions
569+
log.warning('There was an error with the repository', exc_info=True)
570+
except vcs_support_utils.LockTimeout:
571+
log.info(
572+
'Lock still active: project=%s version=%s',
573+
self.project.slug,
574+
self.version.slug,
575+
)
576+
except Exception:
577+
# Catch unhandled errors when syncing
578+
log.exception(
579+
'An unhandled exception was raised during VCS syncing',
580+
extra={
581+
'stack': True,
582+
'tags': {
583+
'build': self.build['id'],
584+
'project': self.project.slug,
585+
'version': self.version.slug,
586+
},
587+
},
588+
)
589+
552590
commit = self.project.vcs_repo(self.version.slug).commit
553591
if commit:
554592
self.build['commit'] = commit

0 commit comments

Comments
 (0)