BlackLab icon indicating copy to clipboard operation
BlackLab copied to clipboard

usecache=no causes issues

Open jan-niestadt opened this issue 3 years ago • 1 comments

It can be useful to skip the cache for debugging purposes, but this causes problems, because the code relies on e.g. docsCount = searchParam.docsCount().executeAsync().peek(); to return a running docs count for the search we started earlier.

We should refactor to make this explicit and not rely on cache behaviour.

Not a huge issue because usecache=no isn't used in production normally, but should be changed to be less brittle.

jan-niestadt avatar Feb 23 '22 10:02 jan-niestadt

To clarify: the issue is that several Search objects are created from the search parameters, and then these are started using executeAsync(). When the cache is enabled, one search will re-use the result from another search (which, if started first, is already in the cache). When the cache is disabled however, the search that is dependent on another search's result will restart that search instead of using the already running version.

We should either change how these related searches are executed (i.e. making it explicit that we want to execute it using the result from this other search), or we should have a special status for "the cache is disabled but this search is in the cache temporarily. it should only be available to this request, and should be removed when the request has been handled.".

jan-niestadt avatar Jul 04 '22 10:07 jan-niestadt