mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): remove i18n lock and logs
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/compare"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db/lockman"
|
||||
"yunion.io/x/onecloud/pkg/i18n"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
)
|
||||
@@ -177,8 +176,10 @@ func (manager *SI18nManager) RemoveI18ns(ctx context.Context, userCred mcclient.
|
||||
}
|
||||
|
||||
func (manager *SI18nManager) SyncI18ns(ctx context.Context, userCred mcclient.TokenCredential, model IModel, table IModelI18nTable) ([]SI18n, []IModelI18nEntry, compare.SyncResult) {
|
||||
lockman.LockClass(ctx, manager, "")
|
||||
defer lockman.ReleaseClass(ctx, manager, "")
|
||||
//// No need to lock SI18nManager, the resources has been lock in the upper layer - QIU Jian, 20210405
|
||||
// lockman.LockClass(ctx, manager, "")
|
||||
// defer lockman.ReleaseClass(ctx, manager, "")
|
||||
|
||||
syncResult := compare.SyncResult{}
|
||||
|
||||
extItems := manager.getExternalI18nItems(ctx, table)
|
||||
@@ -257,7 +258,7 @@ func (manager *SI18nManager) newFromI18n(ctx context.Context, userCred mcclient.
|
||||
}
|
||||
|
||||
func (self *SI18n) updateFromI18n(ctx context.Context, userCred mcclient.TokenCredential, entry IModelI18nEntry) error {
|
||||
_, err := UpdateWithLock(ctx, self, func() error {
|
||||
_, err := Update(self, func() error {
|
||||
self.KeyValue = entry.GetKeyValue()
|
||||
self.Cn = entry.Lookup(i18n.I18N_TAG_CHINESE)
|
||||
self.En = entry.Lookup(i18n.I18N_TAG_ENGLISH)
|
||||
@@ -273,8 +274,8 @@ func (self *SI18n) updateFromI18n(ctx context.Context, userCred mcclient.TokenCr
|
||||
}
|
||||
|
||||
func (self *SI18n) removeI18n(ctx context.Context, userCred mcclient.TokenCredential) error {
|
||||
lockman.LockObject(ctx, self)
|
||||
defer lockman.ReleaseObject(ctx, self)
|
||||
// lockman.LockObject(ctx, self)
|
||||
// defer lockman.ReleaseObject(ctx, self)
|
||||
|
||||
err := self.Delete(ctx, userCred)
|
||||
return err
|
||||
|
||||
@@ -31,11 +31,10 @@ func (man *SI18nResourceBaseManager) SyncI18ns(ctx context.Context, userCred mcc
|
||||
itable := man.getSModelI18nTable(model, table)
|
||||
_, _, r := db.I18nManager.SyncI18ns(ctx, userCred, model, itable)
|
||||
if r.IsError() {
|
||||
log.Infof("SyncI18ns for %s %s result: %s", model.Keyword(), model.GetId(), r.Result())
|
||||
log.Errorf("SyncI18ns for %s %s result: %s", model.Keyword(), model.GetId(), r.Result())
|
||||
return errors.Wrap(r.AllError(), "SyncI18ns")
|
||||
}
|
||||
|
||||
log.Debugf("SyncI18ns for %s %s result: %s", model.Keyword(), model.GetId(), r.Result())
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -51,7 +50,7 @@ func (self *SI18nResourceBase) RemoveI18ns(ctx context.Context, userCred mcclien
|
||||
func (self *SI18nResourceBase) GetModelI18N(ctx context.Context, model db.IModel) *jsonutils.JSONDict {
|
||||
entries, err := db.I18nManager.GetModelI18N(ctx, model)
|
||||
if err != nil {
|
||||
log.Infof("GetI18N %s", err)
|
||||
log.Errorf("GetModelI18N error %s", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -66,7 +65,7 @@ func (self *SI18nResourceBase) GetModelI18N(ctx context.Context, model db.IModel
|
||||
func (self *SI18nResourceBase) GetModelKeyI18N(ctx context.Context, model db.IModel, keyName string) (string, bool) {
|
||||
entries, err := db.I18nManager.GetModelKeyI18N(ctx, model, keyName)
|
||||
if err != nil {
|
||||
log.Infof("GetModelKeyI18N %s", err)
|
||||
log.Errorf("GetModelKeyI18N error %s", err)
|
||||
return "", false
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ type ComputeOptions struct {
|
||||
EnableHostHealthCheck bool `help:"enable host health check" default:"true"`
|
||||
HostHealthTimeout int `help:"second of wait host reconnect" default:"60"`
|
||||
|
||||
FetchEtcdServiceInfoAndUseEtcdLock bool `default:"true" help:"fetch etcd service info and use etcd lock"`
|
||||
FetchEtcdServiceInfoAndUseEtcdLock bool `default:"false" help:"fetch etcd service info and use etcd lock"`
|
||||
|
||||
GuestTemplateCheckInterval int `help:"interval between two consecutive inspections of Guest Template in hour unit" default:"12"`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user