The previous in-memory dict only worked with a single gunicorn worker. With workers=2 in gunicorn_config.py, the async-search worker stored the result in its own process memory while the dashboard request landed on the other worker ~50% of the time — cache miss → fell through to a synchronous Box fetch → exceeded the GCP load balancer's 30s timeout, returning "stream timeout" to the user even though the search itself succeeded. Now stores cache entries as pickled files at storage/cache/<key>.pkl, shared across workers via the existing volume mount. Atomic writes via tempfile + os.replace. TTL still 30 minutes. Public API (cache_set/get/delete/cleanup) is unchanged so call sites in reporting/routes.py continue to work. |
||
|---|---|---|
| .. | ||
| templates/reporting | ||
| __init__.py | ||
| aggregator.py | ||
| blueprint.py | ||
| result_cache.py | ||
| routes.py | ||