Commit bc00423
committed
force_refresh: propagate through unwrapped @with_solr_cache decorators
v1.12.9 added force_refresh URL parsing in handle_run_query and a
signature check in _run_query, but the check was looking for a
'force_refresh' parameter by name. The @with_solr_cache decorator in
solr_result_cache.py defines its wrapper as 'def wrapper(*args,
**kwargs)' without @functools.wraps, so inspect.signature(get_instances)
returns the wrapper's signature — no 'force_refresh' parameter visible
— and the kwarg was never forwarded. The SOLR-side cache kept serving
the stale 0 entry for FBbt_00007484 regardless of URL flag, even after
container restart.
Two fixes:
1. ha_api._run_query: also pass force_refresh when the function accepts
**kwargs (VAR_KEYWORD parameter kind). The @with_solr_cache wrapper
pops force_refresh off kwargs before delegating to the inner
function, so this is safe even when the underlying function doesn't
itself declare the parameter.
2. solr_result_cache.with_solr_cache: add @functools.wraps(func) so the
decorated function's signature, name, qualname and docstring are
preserved. Future introspection (and tooling like Sphinx) will then
see the inner function's parameters as expected.
Verified path:
URL ?force_refresh=true
-> handle_run_query parses it, invalidates rcache entry
-> _run_query sees VAR_KEYWORD in fn signature, adds to kwargs
-> wrapper(*args, **kwargs) pops force_refresh, clears its SOLR entry
-> inner get_instances recomputes from Owlery+Neo4j (~31,499 rows for
FBbt_00007484) and the wrapper writes the fresh result back.1 parent b37f7bd commit bc00423
2 files changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
362 | 373 | | |
363 | 374 | | |
364 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
765 | 766 | | |
766 | 767 | | |
767 | 768 | | |
| 769 | + | |
768 | 770 | | |
769 | 771 | | |
770 | 772 | | |
| |||
0 commit comments