mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-28 01:38:10 -07:00
fix #1622
Allow users to set max MySQL connections and connection lifetime; set a sane default for max connections if it's not present.
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -1478,6 +1479,12 @@ func LoadConfig(filename string) (config *Config, err error) {
|
||||
|
||||
config.Datastore.MySQL.ExpireTime = time.Duration(config.History.Restrictions.ExpireTime)
|
||||
config.Datastore.MySQL.TrackAccountMessages = config.History.Retention.EnableAccountIndexing
|
||||
if config.Datastore.MySQL.MaxConns == 0 {
|
||||
// #1622: not putting an upper limit on the number of MySQL connections is
|
||||
// potentially dangerous. as a naive heuristic, assume they're running on the
|
||||
// same machine:
|
||||
config.Datastore.MySQL.MaxConns = runtime.NumCPU()
|
||||
}
|
||||
|
||||
config.Server.Cloaks.Initialize()
|
||||
if config.Server.Cloaks.Enabled {
|
||||
|
||||
Reference in New Issue
Block a user