Commit 676c8ec8 authored by Eric's avatar Eric

[Update] optimize memory usage

parent 3ed7a99f
......@@ -172,18 +172,14 @@ var Conf = &Config{
ZipTmpPath: "/tmp",
}
func SetConf(conf *Config) {
func SetConf(conf Config) {
lock.Lock()
defer lock.Unlock()
Conf = conf
Conf = &conf
}
func GetConf() *Config {
func GetConf() Config {
lock.RLock()
defer lock.RUnlock()
var conf Config
if confBytes, err := json.Marshal(Conf); err == nil {
_ = json.Unmarshal(confBytes, &conf)
}
return &conf
return *Conf
}
......@@ -87,7 +87,7 @@ func MustLoadServerConfigOnce() {
func LoadConfigFromServer() (err error) {
conf := config.GetConf()
_, err = authClient.Get(TerminalConfigURL, conf)
_, err = authClient.Get(TerminalConfigURL, &conf)
if err != nil {
return err
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment