diff options
author | George Goldberg <george@gberg.me> | 2017-10-25 19:48:29 +0100 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-10-25 14:48:29 -0400 |
commit | dcb59058cf3d9e489822661fddc81fd051c4f728 (patch) | |
tree | bbfa56898a10feacf802938c4ba64df2668a1ee0 | |
parent | 4491b5ecdfad96959f9a9ab32a5f127bbfa7eac5 (diff) | |
download | chat-dcb59058cf3d9e489822661fddc81fd051c4f728.tar.gz chat-dcb59058cf3d9e489822661fddc81fd051c4f728.tar.bz2 chat-dcb59058cf3d9e489822661fddc81fd051c4f728.zip |
PLT-7976: Configurable timeout for Elasticsearch requests. (#7716)
-rw-r--r-- | config/default.json | 3 | ||||
-rw-r--r-- | i18n/en.json | 4 | ||||
-rw-r--r-- | model/config.go | 10 |
3 files changed, 16 insertions, 1 deletions
diff --git a/config/default.json b/config/default.json index b85fec527..33b52022a 100644 --- a/config/default.json +++ b/config/default.json @@ -318,7 +318,8 @@ "PostsAggregatorJobStartTime": "03:00", "IndexPrefix": "", "LiveIndexingBatchSize": 1, - "BulkIndexingTimeWindowSeconds": 3600 + "BulkIndexingTimeWindowSeconds": 3600, + "RequestTimeoutSeconds": 30 }, "DataRetentionSettings": { "EnableMessageDeletion": false, diff --git a/i18n/en.json b/i18n/en.json index a684c5be0..4a37757af 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -3888,6 +3888,10 @@ "translation": "Elasticsearch Bulk Indexing Time Window must be at least 1 second." }, { + "id": "model.config.is_valid.elastic_search.request_timeout_seconds.app_error", + "translation": "Elasticsearch Request Timeout must be at least 1 second." + }, + { "id": "ent.emoji.licence_disable.app_error", "translation": "Custom emoji restrictions disabled by current license. Please contact your system administrator about upgrading your enterprise license." }, diff --git a/model/config.go b/model/config.go index 493a432bb..f24208754 100644 --- a/model/config.go +++ b/model/config.go @@ -142,6 +142,7 @@ const ( ELASTICSEARCH_SETTINGS_DEFAULT_INDEX_PREFIX = "" ELASTICSEARCH_SETTINGS_DEFAULT_LIVE_INDEXING_BATCH_SIZE = 1 ELASTICSEARCH_SETTINGS_DEFAULT_BULK_INDEXING_TIME_WINDOW_SECONDS = 3600 + ELASTICSEARCH_SETTINGS_DEFAULT_REQUEST_TIMEOUT_SECONDS = 30 DATA_RETENTION_SETTINGS_DEFAULT_MESSAGE_RETENTION_DAYS = 365 DATA_RETENTION_SETTINGS_DEFAULT_FILE_RETENTION_DAYS = 365 @@ -491,6 +492,7 @@ type ElasticsearchSettings struct { IndexPrefix *string LiveIndexingBatchSize *int BulkIndexingTimeWindowSeconds *int + RequestTimeoutSeconds *int } type DataRetentionSettings struct { @@ -1431,6 +1433,10 @@ func (o *Config) SetDefaults() { *o.ElasticsearchSettings.BulkIndexingTimeWindowSeconds = ELASTICSEARCH_SETTINGS_DEFAULT_BULK_INDEXING_TIME_WINDOW_SECONDS } + if o.ElasticsearchSettings.RequestTimeoutSeconds == nil { + o.ElasticsearchSettings.RequestTimeoutSeconds = NewInt(ELASTICSEARCH_SETTINGS_DEFAULT_REQUEST_TIMEOUT_SECONDS) + } + if o.DataRetentionSettings.EnableMessageDeletion == nil { o.DataRetentionSettings.EnableMessageDeletion = NewBool(false) } @@ -1824,6 +1830,10 @@ func (ess *ElasticsearchSettings) isValid() *AppError { return NewAppError("Config.IsValid", "model.config.is_valid.elastic_search.bulk_indexing_time_window_seconds.app_error", nil, "", http.StatusBadRequest) } + if *ess.RequestTimeoutSeconds < 1 { + return NewAppError("Config.IsValid", "model.config.is_valid.elastic_search.request_timeout_seconds.app_error", nil, "", http.StatusBadRequest) + } + return nil } |