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 2018/06/20 08:30:38 UTC

[GitHub] little-cui closed pull request #375: SCB-678 Optimize govern api

little-cui closed pull request #375: SCB-678 Optimize govern api
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/375
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/server/govern/service.go b/server/govern/service.go
index c96dab01..e0c695f6 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


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services