Open amercader opened 1 month ago
This is to prevent repeated parsing for performance reasons but you're right it doesn't get cleared out when the configuration is reloaded.
What's the best fix, should the presets be cached in the configuration object instead?
should the presets be cached in the configuration object instead?
But then they will have to be refreshed on each update_config()
call anyway right? Wouldn't that be the same that removing the caching?
Oh, I didn't notice that _load_presets is only called from update_config. Let's simply remove those two lines.
Looks like the first time presets are loaded they are set for the rest of the session. This causes problems in tests that load different sets of presets, e.g.
When run individually,
test_other.py
will run fine, but iftest_something.py
has been run before it will fail withLooks like these lines prevent further re-loading of the presets on each
update_config()
call:https://github.com/ckan/ckanext-scheming/blob/27035f4d5b3722c2bc64d39b6c2b1d76c9883636/ckanext/scheming/plugins.py#L106-L107
Is this just for performance reasons @wardi ? or to avoid conflicts?