Lee-W commented on code in PR #69849:
URL: https://github.com/apache/airflow/pull/69849#discussion_r4695602596


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2999,7 +3054,11 @@ def _collect_gated_asset_events(
         if not self._is_asset_condition_met(dag, locked_records=records, 
session=session):
             self._delete_consumed_asset_records(dag, locked_records=records, 
session=session)
             return None
-        return records, self._select_consumed_asset_events(dag, 
locked_records=records, session=session)
+        return records, (
+            select(AssetEvent.id.label("event_id"))
+            .where(_build_consumable_asset_event_clause(dag, 
locked_records=records))
+            .order_by(AssetEvent.timestamp.asc(), AssetEvent.id.asc())
+        )

Review Comment:
   Capped the `select` at `max(AssetEvent.id)` taken right after the condition 
check, so events queued later wait for the next run.
   
   An event with a lower ID that commits afterwards can still match, same as on 
the batched path.



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