You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/04/29 09:21:06 UTC

[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #962: SCB-2094 Add heartbeat ws interface

tianxiaoliang commented on a change in pull request #962:
URL: https://github.com/apache/servicecomb-service-center/pull/962#discussion_r622877093



##########
File path: datasource/etcd/util/instance_util.go
##########
@@ -65,6 +65,16 @@ func GetInstance(ctx context.Context, domainProject string, serviceID string, in
 	return resp.Kvs[0].Value.(*pb.MicroServiceInstance), nil
 }
 
+func InstanceExist(ctx context.Context, domainProject string, serviceID string, instanceID string) bool {
+	key := path.GenerateInstanceKey(domainProject, serviceID, instanceID)
+	opts := append(FromContext(ctx), client.WithStrKey(key))
+	resp, err := kv.Store().Instance().Search(ctx, opts...)
+	if err != nil || resp.Count == 0 {

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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org