Skip to content

Commit

Permalink
Fix recursive error from editor using datapusher (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpolidori committed Aug 15, 2021
1 parent 4f51e8d commit 8958c77
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
30 changes: 16 additions & 14 deletions ckanext/querytool/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,29 @@
log = logging.getLogger(__name__)


# Test disabling lru_cache

# Module API

def resource_delete(context, data_dict):
_clear_get_resource_data_cache()
return delete_core.resource_delete(context, data_dict)
# def resource_delete(context, data_dict):
# _clear_get_resource_data_cache()
# return delete_core.resource_delete(context, data_dict)


def resource_patch(context, data_dict):
_clear_get_resource_data_cache()
return patch_core.resource_patch(context, data_dict)
# def resource_patch(context, data_dict):
# _clear_get_resource_data_cache()
# return patch_core.resource_patch(context, data_dict)


def resource_update(context, data_dict):
_clear_get_resource_data_cache()
return update_core.resource_update(context, data_dict)
# def resource_update(context, data_dict):
# _clear_get_resource_data_cache()
# return update_core.resource_update(context, data_dict)


# Internal

def _clear_get_resource_data_cache():
log.debug('Cache statistics for `helpers.get_resource_data`:')
log.debug(helpers.get_resource_data.cache_info())
helpers.get_resource_data.cache_clear()
log.debug('Cache for `helpers.get_resource_data` has been reset')
# def _clear_get_resource_data_cache():
# log.debug('Cache statistics for `helpers.get_resource_data`:')
# log.debug(helpers.get_resource_data.cache_info())
# helpers.get_resource_data.cache_clear()
# log.debug('Cache for `helpers.get_resource_data` has been reset')
2 changes: 1 addition & 1 deletion ckanext/querytool/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def get_map_data(geojson_url, map_key_field, data_key_field,
return map_data


@functools32.lru_cache(maxsize=128)
# @functools32.lru_cache(maxsize=128)
def get_resource_data(sql_string):
context = {}

Expand Down
7 changes: 4 additions & 3 deletions ckanext/querytool/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,12 @@ def after_map(self, map):
# IActions

def get_actions(self):
# Disable lru_cache
module_root = 'ckanext.querytool.logic.action'
action_functions = h._get_functions(module_root)
action_functions['resource_delete'] = actions.resource_delete
action_functions['resource_patch'] = actions.resource_patch
action_functions['resource_update'] = actions.resource_update
# action_functions['resource_delete'] = actions.resource_delete
# action_functions['resource_patch'] = actions.resource_patch
# action_functions['resource_update'] = actions.resource_update
return action_functions

# IConfigurable
Expand Down

0 comments on commit 8958c77

Please sign in to comment.