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 /model/config.go | |
parent | 4491b5ecdfad96959f9a9ab32a5f127bbfa7eac5 (diff) | |
download | chat-dcb59058cf3d9e489822661fddc81fd051c4f728.tar.gz chat-dcb59058cf3d9e489822661fddc81fd051c4f728.tar.bz2 chat-dcb59058cf3d9e489822661fddc81fd051c4f728.zip |
PLT-7976: Configurable timeout for Elasticsearch requests. (#7716)
Diffstat (limited to 'model/config.go')
-rw-r--r-- | model/config.go | 10 |
1 files changed, 10 insertions, 0 deletions
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 } |