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