mirror of https://github.com/apache/lucene.git
Avoid thread contention in LRUQueryCache test
This commit is contained in:
parent
34d3282ede
commit
a2fdbc9353
|
@ -1475,7 +1475,11 @@ public class TestLRUQueryCache extends LuceneTestCase {
|
|||
w.addDocument(new Document());
|
||||
w.commit();
|
||||
DirectoryReader reader = DirectoryReader.open(w);
|
||||
IndexSearcher searcher = newSearcher(reader);
|
||||
|
||||
// Don't use newSearcher(), because that will sometimes use an ExecutorService, and
|
||||
// we need to be single threaded to ensure that LRUQueryCache doesn't skip the cache
|
||||
// due to thread contention
|
||||
IndexSearcher searcher = new AssertingIndexSearcher(random(), reader);
|
||||
searcher.setQueryCachingPolicy(QueryCachingPolicy.ALWAYS_CACHE);
|
||||
|
||||
LRUQueryCache cache = new LRUQueryCache(1, 10000, context -> true, Float.POSITIVE_INFINITY);
|
||||
|
|
Loading…
Reference in New Issue