Skip to content

Commit

Permalink
Fix recycle related bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lihuoran committed Sep 7, 2021
1 parent f107aad commit b678093
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ maro_venv/
pyvenv.cfg
htmlcov/
.coverage

.coveragerc
5 changes: 4 additions & 1 deletion maro/event_buffer/event_linked_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ def _extract_sub_events(self, event: CascadeEvent) -> None:
def _clear_finished_events(self) -> None:
"""Remove all finished events from the head of the list.
"""
while self._head.next_event is not None and self._head.next_event.state == EventState.FINISHED:
def _is_finish(event: ActualEvent) -> bool:
return event.state in (EventState.FINISHED, EventState.RECYCLING)

while self._head.next_event is not None and _is_finish(self._head.next_event):
event = self._head.next_event
self._head.next_event = event.next_event
self._count -= 1
Expand Down

0 comments on commit b678093

Please sign in to comment.