Przeglądaj źródła

Merge pull request #2418 from weseek/feat/elasticsearch-req-timeout-with-env-var

add ELASTICSEARCH_REQUEST_TIMEOUT to ConfigManager
Yuki Takei 5 lat temu
rodzic
commit
82e7e19d2f

+ 2 - 1
CHANGES.md

@@ -2,7 +2,8 @@
 
 ## v4.0.7-RC
 
-* Inprovement: Apply styles faster on booting client
+* Feature: Set request timeout for Elasticsearch with env var `ELASTICSEARCH_REQUEST_TIMEOUT`
+* Improvement: Apply styles faster on booting client
 * Fix: Styles are not applyed on installer
 * Fix: Remove last-resort `next()`
 

+ 6 - 0
src/server/service/config-loader.js

@@ -143,6 +143,12 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
     type:    TYPES.STRING,
     default: null,
   },
+  ELASTICSEARCH_REQUEST_TIMEOUT: {
+    ns:      'crowi',
+    key:     'app:elasticsearchRequestTimeout',
+    type:    TYPES.NUMBER,
+    default: 8000, // msec
+  },
   SEARCHBOX_SSL_URL: {
     ns:      'crowi',
     key:     'app:searchboxSslUrl',

+ 1 - 1
src/server/service/search-delegator/elasticsearch.js

@@ -59,7 +59,7 @@ class ElasticsearchDelegator {
     this.client = new elasticsearch.Client({
       host,
       httpAuth,
-      requestTimeout: 5000,
+      requestTimeout: this.configManager.getConfig('crowi', 'app:elasticsearchRequestTimeout'),
       // log: 'debug',
     });
     this.indexName = indexName;