robotLJW commented on a change in pull request #1262:
URL: 
https://github.com/apache/servicecomb-service-center/pull/1262#discussion_r806384490



##########
File path: datasource/etcd/util/dependency_util.go
##########
@@ -120,15 +123,21 @@ func AddServiceVersionRule(ctx context.Context, 
domainProject string, consumer *
 
        id := util.StringJoin([]string{provider.AppId, provider.ServiceName}, 
"_")
        key := path.GenerateConsumerDependencyQueueKey(domainProject, 
consumer.ServiceId, id)
-       override, err := etcdadpt.InsertBytes(ctx, key, data)
+       opts := make([]etcdadpt.OpOptions, 0)
+       opts = append(opts, etcdadpt.OpPut(etcdadpt.WithStrKey(key), 
etcdadpt.WithValue(data)))
+       syncOpts, err := esync.GenUpdateOpts(ctx, datasource.ResourceKV, data, 
esync.WithOpts(map[string]string{"key": key}))
        if err != nil {
-               return err
+               log.Error("fail to create sync opts", err)
+               return pb.NewError(pb.ErrInternal, err.Error())
        }
-       if override {
-               log.Info(fmt.Sprintf("put in queue[%s/%s]: 
consumer[%s/%s/%s/%s] -> provider[%s/%s/%s]", consumer.ServiceId, id,
-                       consumer.Environment, consumer.AppId, 
consumer.ServiceName, consumer.Version,
-                       provider.Environment, provider.AppId, 
provider.ServiceName))
+       opts = append(opts, syncOpts...)
+       err = etcdadpt.Txn(ctx, opts)
+       if err != nil {
+               return err
        }
+       log.Info(fmt.Sprintf("put in queue[%s/%s]: consumer[%s/%s/%s/%s] -> 
provider[%s/%s/%s]", consumer.ServiceId, id,

Review comment:
       已经修复




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to