refactor: skip a enricher if fields it can provide are already filled

This commit is contained in:
2026-04-03 17:51:59 +02:00
parent 8c3d64d4b8
commit aab23e6b8d
5 changed files with 19 additions and 1 deletions
+6
View File
@@ -26,6 +26,12 @@ def enrich_track(track: TrackMeta) -> TrackMeta:
"""
for enricher in _ENRICHERS:
try:
# Skip if all provided fields are already filled
if all(
getattr(track, field, None) is not None for field in enricher.provides
):
continue
result = enricher.enrich(track)
except Exception as e:
logger.warning(f"Enricher {enricher.name} failed: {e}")