The card render endpoint's file-on-disk cache short-circuit returned FileResponse immediately when the cached PNG existed, bypassing the backfill BackgroundTask that populates battingcard.image_url / pitchingcard.image_url. If a variant row was later recreated with image_url=NULL while the PNG was still cached, the DB column stayed NULL forever, breaking every downstream consumer that reads image_url for display. Extract the backfill-scheduling logic into a _schedule_variant_image_backfill helper and call it on both the cache-hit and full-render paths. The helper's internal guards (variant > 0, tier is None, row exists with NULL image_url) keep the happy-path cache hit a no-op. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| models | ||
| routers_v2 | ||
| seed | ||
| services | ||
| __init__.py | ||
| card_creation.py | ||
| db_engine.py | ||
| db_helpers.py | ||
| dependencies.py | ||
| main.py | ||
| player_scouting.py | ||