fix #2650 add heartbeat_interval

This commit is contained in:
Shinsuke Sugaya 2022-05-05 11:38:59 +09:00
parent 5c648bd000
commit 4052edd20a
5 changed files with 33 additions and 2 deletions

View file

@ -33,7 +33,8 @@ public class CrawlerEngineClient extends FesenClient {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final String[] hosts =
split(address, ",").get(stream -> stream.map(s -> s.trim()).filter(StringUtil::isNotEmpty).toArray(n -> new String[n]));
final Builder builder = Settings.builder().putList("http.hosts", hosts).put("processors", fessConfig.getCrawlerHttpProcessors());
final Builder builder = Settings.builder().putList("http.hosts", hosts).put("processors", fessConfig.getCrawlerHttpProcessors())
.put("http.heartbeat_interval", fessConfig.getElasticsearchHeartbeatIntervalAsInteger().longValue());
final String username = fessConfig.getElasticsearchUsername();
final String password = fessConfig.getElasticsearchPassword();
if (StringUtil.isNotBlank(username) && StringUtil.isNotBlank(password)) {

View file

@ -350,7 +350,8 @@ public class SearchEngineClient implements Client {
protected Client createHttpClient(final FessConfig fessConfig, final String host) {
final String[] hosts =
split(host, ",").get(stream -> stream.map(s -> s.trim()).filter(StringUtil::isNotEmpty).toArray(n -> new String[n]));
final Builder builder = Settings.builder().putList("http.hosts", hosts).put("processors", fessConfig.availableProcessors());
final Builder builder = Settings.builder().putList("http.hosts", hosts).put("processors", fessConfig.availableProcessors())
.put("http.heartbeat_interval", fessConfig.getElasticsearchHeartbeatIntervalAsInteger().longValue());
final String username = fessConfig.getElasticsearchUsername();
final String password = fessConfig.getElasticsearchPassword();
if (StringUtil.isNotBlank(username) && StringUtil.isNotBlank(password)) {

View file

@ -76,6 +76,7 @@ public class CurlHelper {
final String[] hosts = split(ResourceUtil.getFesenHttpUrl(), ",")
.get(stream -> stream.map(s -> s.trim()).filter(StringUtil::isNotEmpty).toArray(n -> new String[n]));
nodeManager = new NodeManager(hosts, node -> get(node.getUrl("/")));
nodeManager.setHeartbeatInterval(fessConfig.getElasticsearchHeartbeatIntervalAsInteger().longValue());
}
public CurlRequest get(final String path) {

View file

@ -40,6 +40,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. */
String ELASTICSEARCH_PASSWORD = "elasticsearch.password";
/** The key of the configuration. e.g. 10000 */
String ELASTICSEARCH_heartbeat_interval = "elasticsearch.heartbeat_interval";
/** The key of the configuration. e.g. aes */
String APP_CIPHER_ALGORISM = "app.cipher.algorism";
@ -1811,6 +1814,21 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
Integer getElasticsearchPasswordAsInteger();
/**
* Get the value for the key 'elasticsearch.heartbeat_interval'. <br>
* The value is, e.g. 10000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getElasticsearchHeartbeatInterval();
/**
* Get the value for the key 'elasticsearch.heartbeat_interval' as {@link Integer}. <br>
* The value is, e.g. 10000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getElasticsearchHeartbeatIntervalAsInteger();
/**
* Get the value for the key 'app.cipher.algorism'. <br>
* The value is, e.g. aes <br>
@ -7282,6 +7300,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return getAsInteger(FessConfig.ELASTICSEARCH_PASSWORD);
}
public String getElasticsearchHeartbeatInterval() {
return get(FessConfig.ELASTICSEARCH_heartbeat_interval);
}
public Integer getElasticsearchHeartbeatIntervalAsInteger() {
return getAsInteger(FessConfig.ELASTICSEARCH_heartbeat_interval);
}
public String getAppCipherAlgorism() {
return get(FessConfig.APP_CIPHER_ALGORISM);
}
@ -10139,6 +10165,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
defaultMap.put(FessConfig.ELASTICSEARCH_HTTP_SSL_certificate_authorities, "");
defaultMap.put(FessConfig.ELASTICSEARCH_USERNAME, "");
defaultMap.put(FessConfig.ELASTICSEARCH_PASSWORD, "");
defaultMap.put(FessConfig.ELASTICSEARCH_heartbeat_interval, "10000");
defaultMap.put(FessConfig.APP_CIPHER_ALGORISM, "aes");
defaultMap.put(FessConfig.APP_CIPHER_KEY, "___change__me___");
defaultMap.put(FessConfig.APP_DIGEST_ALGORISM, "sha256");

View file

@ -14,6 +14,7 @@ elasticsearch.http.url=http://localhost:9201
elasticsearch.http.ssl.certificate_authorities=
elasticsearch.username=
elasticsearch.password=
elasticsearch.heartbeat_interval=10000
# Cryptographer
app.cipher.algorism=aes