mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: 避免插入时出现duplicate primary key error
This commit is contained in:
@@ -298,9 +298,9 @@ func (manager *STenantCacheManager) Save(ctx context.Context, idStr string, name
|
||||
obj.Domain = domain
|
||||
obj.DomainId = domainId
|
||||
obj.LastCheck = now
|
||||
err = manager.TableSpec().Insert(obj)
|
||||
err = manager.TableSpec().InsertOrUpdate(obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrap(err, "InsertOrUpdate")
|
||||
} else {
|
||||
return obj, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user