catalog#
Computes and caches the catalog version token so the FastAPI middleware can attach a weak ETag to every /apps* response. The token is the catalogβs newest mutation timestamp (latest ingest plus the latest macOS resolver write), so it changes exactly when the served data changes and never otherwise, which makes it a perfect cache key for both Cloudflare and revalidating clients.
- async recompute_catalog_version(app: FastAPI, session: AsyncSession) str | None[source]#
Recompute the catalog version token and cache it on
app.state.catalog_version.Returns the new token, or
Nonefor an empty catalog (state left untouched). Called at startup and after any live write so the/apps*ETag reflects the current data instead of pinning to the token captured when the process booted.- Parameters:
app (FastAPI)
session (AsyncSession)
- Return type:
str | None