Skip to content

Commit

Permalink
Update TIs with a proper lock (apache#11683)
Browse files Browse the repository at this point in the history
  • Loading branch information
msumit authored Oct 21, 2020
1 parent f468fc5 commit 3caa539
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion airflow/jobs/scheduler_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,8 @@ def _change_state_for_tis_without_dagrun(
# We need to do this for mysql as well because it can cause deadlocks
# as discussed in https://issues.apache.org/jira/browse/AIRFLOW-2516
if self.using_sqlite or self.using_mysql:
tis_to_change: List[TI] = with_row_locks(query).all()
tis_to_change: List[TI] = with_row_locks(query, of=TI,
**skip_locked(session=session)).all()
for ti in tis_to_change:
ti.set_state(new_state, session=session)
tis_changed += 1
Expand Down

0 comments on commit 3caa539

Please sign in to comment.