Skip to content

Commit

Permalink
Merge pull request #4804 from rtfd/humitos/lock/appropiate-log
Browse files Browse the repository at this point in the history
Appropiate logging when a LockTimeout for VCS is reached
  • Loading branch information
ericholscher authored Nov 7, 2018
2 parents c9b25c4 + fa3ce4c commit ce0948f
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

from .constants import LOG_TEMPLATE
from .exceptions import RepositoryError
from .models import Domain, Feature, ImportedFile, Project
from .models import Domain, ImportedFile, Project
from .signals import (
after_build, after_vcs, before_build, before_vcs, files_changed)

Expand Down Expand Up @@ -219,10 +219,24 @@ def run(self, version_pk): # pylint: disable=arguments-differ
except RepositoryError:
# Do not log as ERROR handled exceptions
log.warning('There was an error with the repository', exc_info=True)
except vcs_support_utils.LockTimeout:
log.info(
'Lock still active: project=%s version=%s',
self.project.slug,
self.version.slug,
)
except Exception:
# Catch unhandled errors when syncing
log.exception(
'An unhandled exception was raised during VCS syncing',
extra={
'stack': True,
'tags': {
'project': self.project.slug,
'version': self.version.slug,
},
},

)
return False

Expand Down Expand Up @@ -557,7 +571,31 @@ def setup_vcs(self):
version=self.version.slug,
msg='Updating docs from VCS',
))
self.sync_repo()
try:
self.sync_repo()
except RepositoryError:
# Do not log as ERROR handled exceptions
log.warning('There was an error with the repository', exc_info=True)
except vcs_support_utils.LockTimeout:
log.info(
'Lock still active: project=%s version=%s',
self.project.slug,
self.version.slug,
)
except Exception:
# Catch unhandled errors when syncing
log.exception(
'An unhandled exception was raised during VCS syncing',
extra={
'stack': True,
'tags': {
'build': self.build['id'],
'project': self.project.slug,
'version': self.version.slug,
},
},
)

commit = self.project.vcs_repo(self.version.slug).commit
if commit:
self.build['commit'] = commit
Expand Down

0 comments on commit ce0948f

Please sign in to comment.