keepalive default of 300 seconds

This commit is contained in:
Josh Baker 2017-08-24 14:15:07 -07:00
parent 77632d8cc3
commit 730502d99d
1 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,10 @@ import (
"github.com/tidwall/tile38/controller/server" "github.com/tidwall/tile38/controller/server"
) )
const (
defaultKeepAlive = 300 // seconds
)
const ( const (
RequirePass = "requirepass" RequirePass = "requirepass"
LeaderAuth = "leaderauth" LeaderAuth = "leaderauth"
@ -169,7 +173,7 @@ func (c *Controller) setConfigProperty(name, value string, fromLoad bool) error
} }
case KeepAlive: case KeepAlive:
if value == "" { if value == "" {
c.config.KeepAlive = 300 c.config.KeepAlive = defaultKeepAlive
} else { } else {
keepalive, err := strconv.ParseUint(value, 10, 64) keepalive, err := strconv.ParseUint(value, 10, 64)
if err != nil { if err != nil {
@ -217,6 +221,7 @@ func (c *Controller) getConfigProperty(name string) string {
func (c *Controller) initConfig() error { func (c *Controller) initConfig() error {
c.config = Config{ServerID: randomKey(16)} c.config = Config{ServerID: randomKey(16)}
c.config.KeepAlive = defaultKeepAlive
return c.writeConfig(true) return c.writeConfig(true)
} }