Skip to content

Commit

Permalink
Use SKIP LOCKED instead of NOWAIT in mini scheduler (#39745)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7dc2b52)
  • Loading branch information
VladimirYushkevich authored and ephraimbuddy committed Jun 4, 2024
1 parent 7a0fb85 commit e4baada
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions airflow/models/taskinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3455,8 +3455,13 @@ def _schedule_downstream_tasks(
run_id=ti.run_id,
),
session=session,
nowait=True,
).one()
skip_locked=True,
).one_or_none()

if not dag_run:
cls.logger().debug("Skip locked rows, rollback")
session.rollback()
return

task = ti.task
if TYPE_CHECKING:
Expand Down

0 comments on commit e4baada

Please sign in to comment.