You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2023/03/22 14:55:32 UTC

[servicecomb-kie] branch master updated: [fix] List api may return nil data, which is not permitted (#286)

This is an automated email from the ASF dual-hosted git repository.

littlecui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-kie.git


The following commit(s) were added to refs/heads/master by this push:
     new a105b22  [fix] List api may return nil data, which is not permitted (#286)
a105b22 is described below

commit a105b2269fc4c9407bc57330998ecb5384ddb570
Author: kkf1 <46...@users.noreply.github.com>
AuthorDate: Wed Mar 22 22:55:25 2023 +0800

    [fix] List api may return nil data, which is not permitted (#286)
---
 server/datasource/etcd/kv/kv_cache.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/server/datasource/etcd/kv/kv_cache.go b/server/datasource/etcd/kv/kv_cache.go
index e3d47e6..5776bf7 100644
--- a/server/datasource/etcd/kv/kv_cache.go
+++ b/server/datasource/etcd/kv/kv_cache.go
@@ -226,7 +226,9 @@ func Search(ctx context.Context, req *CacheSearchReq) (*model.KVResponse, bool,
 	}
 
 	openlog.Debug(fmt.Sprintf("using cache to search kv, domain %v, project %v, opts %+v", req.Domain, req.Project, *req.Opts))
-	result := &model.KVResponse{}
+	result := &model.KVResponse{
+		Data: []*model.KVDoc{},
+	}
 	cacheKey := kvCache.GetCacheKey(req.Domain, req.Project, req.Opts.Labels)
 	kvIds, ok := kvCache.LoadKvIDSet(cacheKey)
 	if !ok {