zhaoyongjie commented on a change in pull request #18576: URL: https://github.com/apache/superset/pull/18576#discussion_r801287340
########## File path: superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx ########## @@ -30,7 +30,7 @@ import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { updateDataMask, clearDataMask } from 'src/dataMask/actions'; import { DataMaskStateWithId, DataMaskWithId } from 'src/dataMask/types'; import { useImmer } from 'use-immer'; -import { isEmpty, isEqual } from 'lodash'; +import { isEmpty, isEqual, debounce } from 'lodash'; Review comment: ```suggestion import { isEmpty, isEqual } from 'lodash'; import { SLOW_DEBOUNCE } from '@superset-ui/core' ``` ########## File path: superset/explore/form_data/commands/create.py ########## @@ -40,7 +41,10 @@ def run(self) -> str: actor = self._cmd_params.actor form_data = self._cmd_params.form_data check_access(dataset_id, chart_id, actor) - key = token_urlsafe(48) + contextual_key = cache_key(actor.get_user_id(), dataset_id, chart_id) Review comment: 1. In order to separate different session for same user, use session id instead of user id ```python from flask import session ... ... contextual_key = cache_key(session.get('_id'), dataset_id, chart_id) ``` 2. there is already a general hash module in `superset.utils.hashing` ``` import from md5_sha_from_str from superset.utils.hashing contextual_key = md5_sha_from_str(<string variable>) ``` ########## File path: superset/key_value/api.py ########## @@ -122,9 +113,7 @@ def put(self, pk: int, key: str) -> Response: def get(self, pk: int, key: str) -> Response: try: - args = CommandParameters( - actor=g.user, resource_id=pk, key=key, query_params=request.args - ) + args = CommandParameters(actor=g.user, resource_id=pk, key=key) value = self.get_get_command()(args).run() if not value: Review comment: What happens if the cache temporarily unavailable? we should set cache if cache broke down. ########## File path: superset/dashboards/filter_state/commands/delete.py ########## @@ -34,5 +34,7 @@ def delete(self, cmd_params: CommandParameters) -> bool: if entry: if entry["owner"] != actor.get_user_id(): raise KeyValueAccessDeniedError() + contextual_key = cache_key(actor.get_user_id(), resource_id) Review comment: same above(commands/create.py) ########## File path: superset/explore/form_data/commands/create.py ########## @@ -49,6 +53,7 @@ def run(self) -> str: "form_data": form_data, } cache_manager.explore_form_data_cache.set(key, state) + cache_manager.explore_form_data_cache.set(contextual_key, key) return key except SQLAlchemyError as ex: Review comment: There isn't SQLAlchemy operation, please change to a more explicit exception. ########## File path: superset/dashboards/filter_state/commands/create.py ########## @@ -23,13 +25,17 @@ class CreateFilterStateCommand(CreateKeyValueCommand): - def create(self, cmd_params: CommandParameters) -> bool: + def create(self, cmd_params: CommandParameters) -> str: resource_id = cmd_params.resource_id actor = cmd_params.actor - key = cache_key(resource_id, cmd_params.key) + contextual_key = cache_key(actor.get_user_id(), resource_id) Review comment: same above(commands/create.py) -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org