Merge pull request #5073 from jmchilton/backport_5045

[17.09] Backport #5045
This commit is contained in:
Eric Rasche
2017-11-28 14:22:28 +00:00
committed by GitHub
+5 -3
View File
@@ -202,10 +202,10 @@ class WorkflowRequestMonitor(object):
sa_session = self.app.model.context
workflow_invocation = sa_session.query(model.WorkflowInvocation).get(invocation_id)
if not workflow_invocation or not workflow_invocation.active:
return False
try:
if not workflow_invocation or not workflow_invocation.active:
return False
# This ensures we're only ever working on the 'first' active
# workflow invocation in a given history, to force sequential
# activation.
@@ -218,6 +218,8 @@ class WorkflowRequestMonitor(object):
# TODO: eventually fail this - or fail it right away?
log.exception("Exception raised while attempting to schedule workflow request.")
return False
finally:
sa_session.expunge_all()
# A workflow was obtained and scheduled...
return True