mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-27 14:02:15 +08:00
fix: config
This commit is contained in:
parent
51fe509f79
commit
4963b8fd69
@ -216,19 +216,23 @@ func (cm *ConfigManager) resetConfig(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ops := make([]clientv3.Op, 0)
|
||||||
for _, k := range changedKeys {
|
for _, k := range changedKeys {
|
||||||
data, err := json.Marshal(configMap[k].new)
|
data, err := json.Marshal(configMap[k].new)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ZError(c, "marshal config failed", err)
|
log.ZError(c, "marshal config failed", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
txn = txn.Then(clientv3.OpPut(etcd.BuildKey(k), string(data)))
|
ops = append(ops, clientv3.OpPut(etcd.BuildKey(k), string(data)))
|
||||||
}
|
}
|
||||||
|
if len(ops) > 0 {
|
||||||
|
txn.Then(ops...)
|
||||||
_, err := txn.Commit()
|
_, err := txn.Commit()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ZError(c, "commit etcd txn failed", err)
|
log.ZError(c, "commit etcd txn failed", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cm *ConfigManager) Restart(c *gin.Context) {
|
func (cm *ConfigManager) Restart(c *gin.Context) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user