Merge pull request #4625 from beeankha/approval_timeout_websocket

Update Approval Node Count in the Event of a Timeout

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-08-29 21:15:06 +00:00 committed by GitHub
commit 3c82785eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -527,11 +527,14 @@ class TaskManager():
if task.timeout == 0:
continue
if (now - task.created) >= approval_timeout_seconds:
timeout_message = "The approval node {} ({}) has expired after {} seconds.".format(task.name, task.pk, task.timeout)
timeout_message = _(
"The approval node {name} ({pk}) has expired after {timeout} seconds."
).format(name=task.name, pk=task.pk, timeout=task.timeout)
logger.warn(timeout_message)
task.timed_out = True
task.status = 'failed'
task.job_explanation = _(timeout_message)
task.websocket_emit_status(task.status)
task.job_explanation = timeout_message
task.save(update_fields=['status', 'job_explanation', 'timed_out'])
def calculate_capacity_consumed(self, tasks):