Add dedicated scheduler
This commit is contained in:
parent
1cd5fc8eed
commit
24cf7ea58d
|
@ -93,7 +93,13 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
||||||
new ShortNamedThreadFactory("heavy-tasks").setDaemon(true).withGroup(new ThreadGroup("lucene-heavy-tasks")),
|
new ShortNamedThreadFactory("heavy-tasks").setDaemon(true).withGroup(new ThreadGroup("lucene-heavy-tasks")),
|
||||||
Math.toIntExact(Duration.ofHours(1).toSeconds())
|
Math.toIntExact(Duration.ofHours(1).toSeconds())
|
||||||
));
|
));
|
||||||
private static final Scheduler bulkScheduler = uninterruptibleScheduler(Schedulers.boundedElastic());
|
private static final Scheduler luceneWriteScheduler = uninterruptibleScheduler(Schedulers.newBoundedElastic(
|
||||||
|
DEFAULT_BOUNDED_ELASTIC_SIZE,
|
||||||
|
DEFAULT_BOUNDED_ELASTIC_QUEUESIZE,
|
||||||
|
new ShortNamedThreadFactory("lucene-write").setDaemon(true).withGroup(new ThreadGroup("lucene-write")),
|
||||||
|
Math.toIntExact(Duration.ofHours(1).toSeconds())
|
||||||
|
));
|
||||||
|
private static final Scheduler bulkScheduler = luceneWriteScheduler;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
LLUtils.initHooks();
|
LLUtils.initHooks();
|
||||||
|
@ -258,7 +264,7 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
||||||
private <V> Mono<V> runSafe(Callable<V> callable) {
|
private <V> Mono<V> runSafe(Callable<V> callable) {
|
||||||
return Mono
|
return Mono
|
||||||
.fromCallable(callable)
|
.fromCallable(callable)
|
||||||
.subscribeOn(uninterruptibleScheduler(Schedulers.boundedElastic()))
|
.subscribeOn(luceneWriteScheduler)
|
||||||
.publishOn(Schedulers.parallel());
|
.publishOn(Schedulers.parallel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +428,7 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
||||||
shutdownLock.unlock();
|
shutdownLock.unlock();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}).subscribeOn(luceneHeavyTasksScheduler).transform(this::ensureOpen);
|
}).subscribeOn(luceneHeavyTasksScheduler).publishOn(Schedulers.parallel()).transform(this::ensureOpen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user