Avoid user notifications when LockTimeout is received
* Avoid user notifications when LockTimeout is received
LockTimeout happens when there are more than one build trigger almost
at the same time.
* Clean up code comment
@@ -158,7 +158,13 @@ class UpdateDocsTask(Task):
if self.setup_env.failure or self.config is None:
self._log('Failing build because of setup failure: %s' % self.setup_env.failure)
+
+ # Send notification to users only if the build didn't fail because of
+ # LockTimeout: this exception occurs when a build is triggered before the previous
+ # one has finished (e.g. two webhooks, one after the other)
+ if not isinstance(self.setup_env.failure, vcs_support_utils.LockTimeout):
self.send_notifications()
+
self.setup_env.update_build(state=BUILD_STATE_FINISHED)
return False
