fix(generator): invalidate composite cache on not_found + drop unused import

Cache entry for widget:composite:{username} was not invalidated when a
user's fetcher payload transitioned to not_found, serving stale SVGs.
This commit is contained in:
shay
2026-04-17 16:56:45 -04:00
parent 07221a1329
commit 961a3330e1
+1 -1
View File
@@ -4,7 +4,6 @@ Run as its own container: CMD python -m src.worker
""" """
import logging import logging
import time import time
from typing import Optional
from . import cache, config, db, fetcher_client, placeholder, processor from . import cache, config, db, fetcher_client, placeholder, processor
from .widgets import compose_widget from .widgets import compose_widget
@@ -46,6 +45,7 @@ def process_one() -> bool:
if payload.get("error") == "not_found": if payload.get("error") == "not_found":
svg = placeholder.render("not_found", username, theme="dark") svg = placeholder.render("not_found", username, theme="dark")
db.put_widgets(username, "not_found", {"composite": svg}) db.put_widgets(username, "not_found", {"composite": svg})
cache.Cache().delete(f"widget:composite:{username}")
db.complete_job(job["id"]) db.complete_job(job["id"])
log.info("not_found marker persisted for %s", username) log.info("not_found marker persisted for %s", username)
return True return True