mirror of
https://github.com/ipnet-mesh/meshcore-hub.git
synced 2026-07-27 12:03:19 +02:00
71f65714ee
After PR #311 wired server-side invalidation, a user reported that editing a Route still showed old values on the routes list for ~30s. Root cause: the api_cache_middleware emitted 'Cache-Control: private, max-age=30' on @cached GETs, which let the browser serve its local HTTP cache copy without revalidating. The Redis invalidation fired correctly but never mattered — the browser never asked the server. Switch all /api/* GET responses to 'private, no-cache' (synonymous with 'max-age=0, must-revalidate'). The browser now sends If-None-Match on every navigation; the server answers 304 when Redis is warm and unchanged (cheap — no body) or 200 after an invalidation. The per-endpoint Redis TTL (30s default, 300s dashboard/route-detail) still bounds cache.set lifetime; only the HTTP-layer max-age disappears. Most navigations are still 304s, so the cost is one tiny round-trip per page load while guaranteeing freshness after any mutation. Adds an end-to-end regression test (test_routes_list_refresh_after_mutation) modelling the exact reported scenario: cache-fill, conditional 304, PUT mutation, conditional 200 with fresh body.