ferruzzi commented on code in PR #68367:
URL: https://github.com/apache/airflow/pull/68367#discussion_r3406504881
##########
airflow-core/src/airflow/assets/manager.py:
##########
@@ -397,7 +397,12 @@ def register_asset_change(
)
)
- stats.incr("asset.updates")
+ team_name = None
+ if task_instance and conf.getboolean("core", "multi_team"):
+ from airflow.models.dag import DagModel
+
+ team_name = DagModel.get_team_name(task_instance.dag_id,
session=session)
Review Comment:
> The cache on `DagModel.get_team_name(...)` covers us from hammering the DB
with this metric right?
Yeah, the TTL cache on `DagModel.get_team_name()` itself should provide a
30-second (configurable) buffer, so repeated calls for the same `dag_id` won't
hammer the DB.
While checking to verify the answer I noticed I'm calling
`DagModel.get_team_name()` twice. I will remove the call on L413 and reuse the
existing value from L404, which may or may not be what you are concerned about.
In theory that second call wold hit the cache, but in hindsight there's no
reason to bother.
(Edit: Re-read your comment and it made more sense the second time around,
sorry about that)
--
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]