villebro opened a new pull request, #43463:
URL: https://github.com/apache/superset/pull/43463
### SUMMARY
Targets `gaq-to-gtf`. A short cache TTL can break the async chart-data flow:
async runs each query, **caches** its result, and the client then re-issues the
request to **read it from cache**. If the result-cache TTL is shorter than that
round trip (task queue + execution + poll interval + re-request), the entry can
be evicted before it's fetched, and the chart hangs / errors.
Add **`GLOBAL_ASYNC_QUERIES_MIN_CACHE_TTL`** (default **300s / 5 min**):
when a query runs on the **async** path, its result-cache TTL is floored to
this value.
- Applied in `QueryContextProcessor.get_cache_timeout`, gated on an
`is_async_execution` flag set **only** by the async task
(`execute_chart_query`). Synchronous `/chart/data` requests are **never**
floored, even when `GLOBAL_ASYNC_QUERIES` is enabled — as requested.
- A longer slice/dataset/deployment timeout is kept as-is (it's a floor, not
an override); `0` ("cache forever" in flask-caching) is left untouched.
- Doesn't affect the cache **key** (only the write TTL), so the client's
sync re-request reads the same entry.
### TESTING INSTRUCTIONS
- `pytest tests/unit_tests/common/test_async_min_cache_ttl.py` — async
floors a short TTL (60→300), keeps a longer one (3600), leaves 0 untouched, and
does **not** floor sync execution.
- `pytest tests/unit_tests/common/test_query_context_processor.py
tests/unit_tests/tasks/test_async_queries.py` — unchanged behavior;
mypy/ruff/pre-commit clean.
### ADDITIONAL INFORMATION
- [ ] Has associated issue
- [x] Required feature flags: `GLOBAL_ASYNC_QUERIES` (the floor only applies
on the async path)
- [ ] Changes UI
- [ ] Includes DB Migration
- [x] Introduces new feature or API (`GLOBAL_ASYNC_QUERIES_MIN_CACHE_TTL`
config)
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]