Skip to content

Commit

Permalink
Make minimal changes to the implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
avkirilishin authored and eladkal committed Jan 10, 2024
1 parent 7c317b7 commit d659a4f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions airflow/timetables/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,15 @@ def next_dagrun_info(
if earliest is None or current_time > earliest:
earliest = pendulum.instance(current_time)

dates = iter(self.event_dates)
next_event = next(dates, None)
while next_event:
is_allowed = True
for next_event in self.event_dates:
if earliest and next_event < earliest:
is_allowed = False
continue
if last_automated_data_interval and next_event <= last_automated_data_interval.end:
is_allowed = False
if is_allowed:
break
next_event = next(dates, None)
if next_event is None:
continue
break
else:
# We need to return None if self.event_dates is empty or,
# if not empty, when no suitable event can be found.
return None

if restriction.latest is not None and next_event > restriction.latest:
Expand Down

0 comments on commit d659a4f

Please sign in to comment.