dstandish commented on a change in pull request #21770:
URL: https://github.com/apache/airflow/pull/21770#discussion_r813325067
##########
File path: airflow/models/trigger.py
##########
@@ -184,7 +184,10 @@ def assign_unassigned(cls, triggerer_id, capacity,
session=None):
# Find triggers who do NOT have an alive triggerer_id, and then assign
# up to `capacity` of those to us.
trigger_ids_query = (
-
session.query(cls.id).filter(cls.triggerer_id.notin_(alive_triggerer_ids)).limit(capacity).all()
+ session.query(cls.id)
+ .filter(or_(cls.triggerer_id.notin_(alive_triggerer_ids),
cls.triggerer_id == None)) # noqa: E711
Review comment:
ok makes sense.
small thing but can i also suggest in that case, put the
cls.triggerer_id.is_(None) _first_ in the OR
then it reads more like "not assigned OR on a dead triggerer"
compared with "on a dead triggerer OR not assigned"
"not assigned" is by far the more common / standard / expected case i think
so seems like it would be more intuitive to put it first. and, it sort of
avoids that issue where first condition looks like it should cover second.
--
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]