john-bodley commented on a change in pull request #15648:
URL: https://github.com/apache/superset/pull/15648#discussion_r669788272



##########
File path: superset/models/dashboard.py
##########
@@ -171,8 +172,21 @@ def url(self) -> str:
 
     @property
     def datasources(self) -> Set[BaseDatasource]:
-        # pylint: disable=using-constant-test
-        return {slc.datasource for slc in self.slices if slc.datasource}

Review comment:
       @villebro per your point we could also use 
[`functools.lru_cache`](https://docs.python.org/3/library/functools.html#functools.lru_cache)
 to cache the `datasource` property for the lifetime of the request. It's 
likely safer than using `@cache.memoize(...)` as there's likely little concern 
that the data will be stale (within the context of a request).




-- 
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]

Reply via email to