dstandish commented on code in PR #51410:
URL: https://github.com/apache/airflow/pull/51410#discussion_r2175543440


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2037,6 +2056,7 @@ def _get_num_times_stuck_in_queued(self, ti: 
TaskInstance, session: Session = NE
                 Log.map_index == ti.map_index,
                 Log.try_number == ti.try_number,
                 Log.event == TASK_STUCK_IN_QUEUED_RESCHEDULE_EVENT,
+                since_running,

Review Comment:
   This is confusing.
   
   Better would be 
   
   ```
   query = ...
   
   if last_running_time:
       query = query.where(Log.dttm > last_running_time)
   ```
   
   the reason it is confusing is, it looks like you are just adding a simple 
boolean.
   
   in which case, just either query or don't.  
   
   but that's actually not the case.  it's half true.  sometimes you are just 
adding `true` -- in which case, why bother adding that as a where clause.  and 
the other half is when you are adding an extra filter.  just conditionally add 
the filter is better to show this.



-- 
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]

Reply via email to