Skip to content

Commit

Permalink
Switch return with can_yield
Browse files Browse the repository at this point in the history
  • Loading branch information
xethorn committed Feb 19, 2015
1 parent b22f689 commit c541836
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions garcon/activity.py
Expand Up @@ -360,17 +360,21 @@ def find_available_activities(flow, history, context):
raise Exception(
'The activity failures has exceeded its retry limit.')

can_yield = True
for requirement in instance.activity_worker.requires:
require_history = history.get(requirement.name)

if not require_history:
return
can_yield = False
break

for requirement_evt in require_history.values():
if not ACTIVITY_COMPLETED in requirement_evt:
return
can_yield = False
break

yield instance
if can_yield:
yield instance


def find_uncomplete_activities(flow, history, context):
Expand Down

0 comments on commit c541836

Please sign in to comment.