uranusjr commented on code in PR #69849:
URL: https://github.com/apache/airflow/pull/69849#discussion_r3744701904


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2733,12 +2762,32 @@ def _create_dag_runs_asset_triggered(
                     else None
                 )
                 stats.incr("asset.triggered_dagruns", 
tags=prune_dict({"team_name": team_name}))
-                dag_run.consumed_asset_events.extend(asset_events)
+                _associate_asset_events_with_dag_run(
+                    dag_run=dag_run,
+                    
asset_event_ids_select=select(selected_asset_events.c.event_id)
+                    .where(
+                        selected_asset_events.c.timestamp <= triggered_date,
+                        selected_asset_events.c.event_id <= 
max_selected_event_id,

Review Comment:
   This _looks_ like dead weight unless the reader understands the CTE is 
re-evaluated fresh in this second, independent query and could pick up events 
inserted after the aggregate read. Add a comment explaining this is a snapshot 
bound against a race, not a no-op.



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