no-hup commented on PR #44017: URL: https://github.com/apache/superset/pull/44017#issuecomment-5771417449
Done in f1aa7f2. The cache now lives on `flask.request` (via `_get_current_object()`) instead of `g`, so it's gone when the request ends rather than surviving to the next request that shares the app context. Same `has_request_context()` guard as before — outside a request we still read through. Added `test_get_user_subject_ids_cache_does_not_leak_across_requests`: one app context, two `test_request_context` blocks, the mocked query returns `[7, 8]` then `[9]`, and it asserts the second request re-queries and sees `[9]`. It fails against the old `g` version (returns the stale `[7, 8]`) and passes with this change. Ran `pytest tests/unit_tests/subjects/test_utils.py` (31 passed), ruff, and mypy locally; didn't run the full suite. -- 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]
