bito-code-review[bot] commented on PR #43149:
URL: https://github.com/apache/superset/pull/43149#issuecomment-5289742739
<!-- Bito Reply -->
The flagged issue is correct. Accessing `app.config` before checking
`should_cache` forces an application context dependency even when caching is
disabled. To resolve this, move the `cache_timeout` logic after the `if not
should_cache:` check.
```python
should_cache = kwargs.pop("cache", True)
force = kwargs.pop("force", False)
if not should_cache:
return f(*args, **kwargs)
cache_timeout = kwargs.pop("cache_timeout", None)
if cache_timeout is None:
cache_timeout = app.config["CACHE_DEFAULT_TIMEOUT"]
```
There are no other comments on this PR to address.
**superset/utils/cache.py**
```
should_cache = kwargs.pop("cache", True)
force = kwargs.pop("force", False)
if not should_cache:
return f(*args, **kwargs)
cache_timeout = kwargs.pop("cache_timeout", None)
if cache_timeout is None:
cache_timeout = app.config["CACHE_DEFAULT_TIMEOUT"]
```
--
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]