فهرست منبع

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

add ELASTICSEARCH_REQUEST_TIMEOUT to ConfigManager
Yuki Takei 5 سال پیش
والد
کامیت
82e7e19d2f
3فایلهای تغییر یافته به همراه9 افزوده شده و 2 حذف شده
  1. 2 1
      CHANGES.md
  2. 6 0
      src/server/service/config-loader.js
  3. 1 1
      src/server/service/search-delegator/elasticsearch.js

+ 2 - 1
CHANGES.md

@@ -2,7 +2,8 @@
 
 
 ## v4.0.7-RC
 ## 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: Styles are not applyed on installer
 * Fix: Remove last-resort `next()`
 * 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,
     type:    TYPES.STRING,
     default: null,
     default: null,
   },
   },
+  ELASTICSEARCH_REQUEST_TIMEOUT: {
+    ns:      'crowi',
+    key:     'app:elasticsearchRequestTimeout',
+    type:    TYPES.NUMBER,
+    default: 8000, // msec
+  },
   SEARCHBOX_SSL_URL: {
   SEARCHBOX_SSL_URL: {
     ns:      'crowi',
     ns:      'crowi',
     key:     'app:searchboxSslUrl',
     key:     'app:searchboxSslUrl',

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

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