Lower the wait on pending works when closing Elasticsearch index managers

Description

When we close an index manager, we need to wait for pending works to finish executing.

In the Elasticsearch backend, unfortunately, we can currently only wait for works of the whole backend to finish executing. This means that, when we close an index manager but another index manager is still open, the wait could theoretically last forever if the open index manager continually pushes works.

In a more realistic scenario, it's possible that index manager closing lasts longer because of this flaw.

To solve this, we should change the way waiting is implemented in org.hibernate.search.engine.backend.orchestration.spi.BatchingExecutor#awaitCompletion. See the TODO on that method.

Note this improvement might not be worth it if we only allow to close index managers when Hibernate Search shuts down and if we implement HSEARCH-3084. If we allow to close index managers at runtime, however, it could bring some improvement.

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Fix versions

Priority

Minor
Configure