Skip to content

Commit

Permalink
Fix issue where new_messages is None (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlowin authored Jun 25, 2024
1 parent 0485706 commit 360e0cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controlflow/controllers/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ async def run_async(self) -> list[MessageType]:
any(t.is_incomplete() for t in self.tasks) and not self._should_stop
):
new_messages = await self.run_once_async()
messages.extend(new_messages)
if new_messages:
messages.extend(new_messages)
self._should_stop = False
return messages

Expand All @@ -337,6 +338,7 @@ def run(self) -> list[MessageType]:
with self.flow:
while any(t.is_incomplete() for t in self.tasks) and not self._should_stop:
new_messages = self.run_once()
messages.extend(new_messages)
if new_messages:
messages.extend(new_messages)
self._should_stop = False
return messages

0 comments on commit 360e0cf

Please sign in to comment.