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 2018/06/20 08:30:38 UTC
[incubator-servicecomb-service-center] branch master updated:
Optimize govern api (#375)
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/incubator-servicecomb-service-center.git
The following commit(s) were added to refs/heads/master by this push:
new 75c5ba2 Optimize govern api (#375)
75c5ba2 is described below
commit 75c5ba2e034ae553ce94319b5633805cb1ea5cce
Author: little-cui <su...@qq.com>
AuthorDate: Wed Jun 20 16:30:36 2018 +0800
Optimize govern api (#375)
---
server/govern/service.go | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/server/govern/service.go b/server/govern/service.go
index c96dab0..e0c695f 100644
--- a/server/govern/service.go
+++ b/server/govern/service.go
@@ -41,6 +41,8 @@ type ServiceDetailOpt struct {
}
func (governService *GovernService) GetServicesInfo(ctx context.Context, in *pb.GetServicesInfoRequest) (*pb.GetServicesInfoResponse, error) {
+ util.SetContext(ctx, serviceUtil.CTX_CACHEONLY, "1")
+
optionMap := make(map[string]struct{}, len(in.Options))
for _, opt := range in.Options {
optionMap[opt] = struct{}{}
@@ -117,6 +119,8 @@ func (governService *GovernService) GetServicesInfo(ctx context.Context, in *pb.
}
func (governService *GovernService) GetServiceDetail(ctx context.Context, in *pb.GetServiceRequest) (*pb.GetServiceDetailResponse, error) {
+ util.SetContext(ctx, serviceUtil.CTX_CACHEONLY, "1")
+
domainProject := util.ParseDomainProject(ctx)
options := []string{"tags", "rules", "instances", "schemas", "dependencies"}
@@ -241,11 +245,9 @@ func getServiceAllVersions(ctx context.Context, serviceKey *pb.MicroServiceKey)
func getSchemaInfoUtil(ctx context.Context, domainProject string, serviceId string) ([]*pb.Schema, error) {
key := apt.GenerateServiceSchemaKey(domainProject, serviceId, "")
- opts := append(serviceUtil.FromContext(ctx),
+ resp, err := backend.Store().Schema().Search(ctx,
registry.WithStrKey(key),
registry.WithPrefix())
-
- resp, err := backend.Store().Schema().Search(ctx, opts...)
if err != nil {
util.Logger().Errorf(err, "Get schema failed")
return make([]*pb.Schema, 0), err