Fix openDecisionTasks counter not updated when we complete a DecisionTask

This commit is contained in:
Jean-Baptiste Barth 2015-10-24 12:05:42 +02:00
commit 49e44c8ee6
2 changed files with 15 additions and 3 deletions

View file

@ -279,10 +279,10 @@ class WorkflowExecution(object):
Handles a Decision according to SWF docs.
See: http://docs.aws.amazon.com/amazonswf/latest/apireference/API_Decision.html
"""
# 'decisions' can be None per boto.swf defaults, so better exiting
# directly for falsy values
# 'decisions' can be None per boto.swf defaults, so replace it with something iterable
if not decisions:
return
decisions = []
# handle each decision separately, in order
for decision in decisions:
decision_type = decision["decisionType"]
@ -306,6 +306,9 @@ class WorkflowExecution(object):
# TODO: implement Decision type: StartTimer
raise NotImplementedError("Cannot handle decision: {}".format(decision_type))
# finally decrement counter if and only if everything went well
self.open_counts["openDecisionTasks"] -= 1
def complete(self, event_id, result=None):
self.execution_status = "CLOSED"
self.close_status = "COMPLETED"