Fix deadlock
This commit is contained in:
parent
08434d475c
commit
99f3686eab
@ -89,11 +89,11 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
|||||||
"lucene-" + name,
|
"lucene-" + name,
|
||||||
60
|
60
|
||||||
);
|
);
|
||||||
private static final Supplier<Scheduler> lowMemorySchedulerSupplier = Suppliers.memoize(() ->
|
private final Supplier<Scheduler> lowMemorySchedulerSupplier = Suppliers.memoize(() ->
|
||||||
Schedulers.newBoundedElastic(1, Schedulers.DEFAULT_BOUNDED_ELASTIC_QUEUESIZE, "lucene-low-memory", Integer.MAX_VALUE))::get;
|
Schedulers.newBoundedElastic(1, Schedulers.DEFAULT_BOUNDED_ELASTIC_QUEUESIZE, "lucene-low-memory", Integer.MAX_VALUE))::get;
|
||||||
private static final Supplier<Scheduler> querySchedulerSupplier = Suppliers.memoize(() -> boundedSchedulerSupplier.apply("query"))::get;
|
private final Supplier<Scheduler> querySchedulerSupplier = Suppliers.memoize(() -> boundedSchedulerSupplier.apply("query"))::get;
|
||||||
private static final Supplier<Scheduler> blockingSchedulerSupplier = Suppliers.memoize(() -> boundedSchedulerSupplier.apply("blocking"))::get;
|
private final Supplier<Scheduler> blockingSchedulerSupplier = Suppliers.memoize(() -> boundedSchedulerSupplier.apply("blocking"))::get;
|
||||||
private static final Supplier<Scheduler> blockingLuceneSearchSchedulerSupplier = Suppliers.memoize(() -> boundedSchedulerSupplier.apply("search-blocking"))::get;
|
private final Supplier<Scheduler> blockingLuceneSearchSchedulerSupplier = Suppliers.memoize(() -> boundedSchedulerSupplier.apply("search-blocking"))::get;
|
||||||
/**
|
/**
|
||||||
* Lucene query scheduler.
|
* Lucene query scheduler.
|
||||||
*/
|
*/
|
||||||
@ -475,7 +475,7 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
|||||||
} else {
|
} else {
|
||||||
return Mono.just(signal);
|
return Mono.just(signal);
|
||||||
}
|
}
|
||||||
}).<LLSearchResult>dematerialize());
|
}).dematerialize());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
|||||||
return Mono.just(signal);
|
return Mono.just(signal);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.<LLSearchResult>dematerialize()
|
.dematerialize()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,15 +567,15 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
|||||||
requestsAvailable.release();
|
requestsAvailable.release();
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
|
||||||
blockingLuceneSearchScheduler.schedule(() -> {
|
|
||||||
try {
|
try {
|
||||||
if (!cancelled.get()) {
|
if (!cancelled.get()) {
|
||||||
if (doDistributedPre) {
|
if (doDistributedPre) {
|
||||||
|
//noinspection BlockingMethodInNonBlockingContext
|
||||||
allowOnlyQueryParsingCollectorStreamSearcher.search(indexSearcher, luceneQuery);
|
allowOnlyQueryParsingCollectorStreamSearcher.search(indexSearcher, luceneQuery);
|
||||||
sink.next(new LLTotalHitsCount(0L));
|
sink.next(new LLTotalHitsCount(0L));
|
||||||
} else {
|
} else {
|
||||||
int boundedLimit = Math.max(0, limit > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) limit);
|
int boundedLimit = Math.max(0, limit > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) limit);
|
||||||
|
//noinspection BlockingMethodInNonBlockingContext
|
||||||
streamSearcher.search(indexSearcher,
|
streamSearcher.search(indexSearcher,
|
||||||
luceneQuery,
|
luceneQuery,
|
||||||
boundedLimit,
|
boundedLimit,
|
||||||
@ -630,11 +630,7 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
sink.error(ex);
|
sink.error(ex);
|
||||||
}
|
}
|
||||||
});
|
}, OverflowStrategy.ERROR).subscribeOn(blockingLuceneSearchScheduler).publishOn(luceneQueryScheduler))));
|
||||||
} catch (Exception ex) {
|
|
||||||
sink.error(ex);
|
|
||||||
}
|
|
||||||
}, OverflowStrategy.BUFFER).subscribeOn(luceneQueryScheduler))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user