AntonioBergonzi commented on code in PR #68244:
URL: https://github.com/apache/airflow/pull/68244#discussion_r3414598145
##########
airflow-core/src/airflow/models/trigger.py:
##########
@@ -252,10 +252,12 @@ def clean_unused(cls, *, session: Session = NEW_SESSION)
-> None:
# Get all triggers that have no task instances, assets, or callbacks
depending on them and delete them
ids = (
select(cls.id)
- .where(~cls.assets.any(), ~cls.callback.has())
- .join(TaskInstance, cls.id == TaskInstance.trigger_id,
isouter=True)
- .group_by(cls.id)
- .having(func.count(TaskInstance.trigger_id) == 0)
+ .where(
+ ~cls.assets.any(),
+ ~cls.callback.has(),
+ ~cls.task_instance.has(),
+ )
+ .with_for_update(skip_locked=True)
)
Review Comment:
@hussein-awala I resolved this. let me know if I should unresolve
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]