Skip to content

Commit 8bf6fdc

Browse files
committed
Fix off-by-one error
1 parent f011da4 commit 8bf6fdc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

azure/durable_functions/models/TaskOrchestrationExecutor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def execute(self, context: DurableOrchestrationContext,
9595
# Combine the is_played field with the history-based signal:
9696
# we are replaying if is_played says so OR if we haven't reached new events yet.
9797
execution_started_event = history[1]
98-
history_is_replaying = self._new_events_start_index > 1
98+
history_is_replaying = self._new_events_start_index >= 0
9999
self.current_task.is_played = execution_started_event.is_played or history_is_replaying
100100

101101
# If user code is a generator, then it uses `yield` statements (the DF API)
@@ -294,7 +294,7 @@ def _find_new_events_start_index(self, history: List[HistoryEvent]) -> int:
294294
The index of the last OrchestratorStarted event, which is the
295295
boundary between old (replayed) and new events.
296296
"""
297-
last_orchestrator_started_index = 0
297+
last_orchestrator_started_index = -1
298298
for i, event in enumerate(history):
299299
if event.event_type == HistoryEventType.ORCHESTRATOR_STARTED:
300300
last_orchestrator_started_index = i

0 commit comments

Comments
 (0)