mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-22049: Add idle timeout to the HTTP server (#13788)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -515,6 +515,7 @@ func (s *Server) Start() error {
|
||||
Handler: handler,
|
||||
ReadTimeout: time.Duration(*s.Config().ServiceSettings.ReadTimeout) * time.Second,
|
||||
WriteTimeout: time.Duration(*s.Config().ServiceSettings.WriteTimeout) * time.Second,
|
||||
IdleTimeout: time.Duration(*s.Config().ServiceSettings.IdleTimeout) * time.Second,
|
||||
ErrorLog: errStdLog,
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ const (
|
||||
SERVICE_SETTINGS_DEFAULT_TLS_KEY_FILE = ""
|
||||
SERVICE_SETTINGS_DEFAULT_READ_TIMEOUT = 300
|
||||
SERVICE_SETTINGS_DEFAULT_WRITE_TIMEOUT = 300
|
||||
SERVICE_SETTINGS_DEFAULT_IDLE_TIMEOUT = 60
|
||||
SERVICE_SETTINGS_DEFAULT_MAX_LOGIN_ATTEMPTS = 10
|
||||
SERVICE_SETTINGS_DEFAULT_ALLOW_CORS_FROM = ""
|
||||
SERVICE_SETTINGS_DEFAULT_LISTEN_AND_ADDRESS = ":8065"
|
||||
@@ -256,6 +257,7 @@ type ServiceSettings struct {
|
||||
TrustedProxyIPHeader []string `restricted:"true"`
|
||||
ReadTimeout *int `restricted:"true"`
|
||||
WriteTimeout *int `restricted:"true"`
|
||||
IdleTimeout *int `restricted:"true"`
|
||||
MaximumLoginAttempts *int `restricted:"true"`
|
||||
GoroutineHealthThreshold *int `restricted:"true"`
|
||||
GoogleDeveloperKey *string `restricted:"true"`
|
||||
@@ -459,6 +461,10 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
|
||||
s.WriteTimeout = NewInt(SERVICE_SETTINGS_DEFAULT_WRITE_TIMEOUT)
|
||||
}
|
||||
|
||||
if s.IdleTimeout == nil {
|
||||
s.IdleTimeout = NewInt(SERVICE_SETTINGS_DEFAULT_IDLE_TIMEOUT)
|
||||
}
|
||||
|
||||
if s.MaximumLoginAttempts == nil {
|
||||
s.MaximumLoginAttempts = NewInt(SERVICE_SETTINGS_DEFAULT_MAX_LOGIN_ATTEMPTS)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user