You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ti...@apache.org on 2021/04/22 01:28:52 UTC
[servicecomb-service-center] branch master updated: SCB-2176 Fix:
Statistics should not contain global services (#955)
This is an automated email from the ASF dual-hosted git repository.
tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git
The following commit(s) were added to refs/heads/master by this push:
new 3675525 SCB-2176 Fix: Statistics should not contain global services (#955)
3675525 is described below
commit 367552503bcc9278c9d976c73e53f5cd5f5fc98c
Author: little-cui <su...@qq.com>
AuthorDate: Thu Apr 22 09:28:41 2021 +0800
SCB-2176 Fix: Statistics should not contain global services (#955)
---
datasource/mongo/util.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/datasource/mongo/util.go b/datasource/mongo/util.go
index 7ea1061..5dd5d38 100644
--- a/datasource/mongo/util.go
+++ b/datasource/mongo/util.go
@@ -69,7 +69,7 @@ func statistics(ctx context.Context, withShared bool) (*pb.Statistics, error) {
svcIDToNonVerKey := datasource.SetStaticServices(result, svcKeys, svcIDs, withShared)
respGetInstanceCountByDomain := make(chan datasource.GetInstanceCountByDomainResponse, 1)
gopool.Go(func(_ context.Context) {
- getInstanceCountByDomain(ctx, svcIDs, respGetInstanceCountByDomain)
+ getInstanceCountByDomain(ctx, svcIDToNonVerKey, respGetInstanceCountByDomain)
})
instances, err := dao.GetInstances(ctx, filter)
@@ -90,11 +90,11 @@ func statistics(ctx context.Context, withShared bool) (*pb.Statistics, error) {
return result, nil
}
-func getInstanceCountByDomain(ctx context.Context, svcIDToNonVerKey []string, resp chan datasource.GetInstanceCountByDomainResponse) {
+func getInstanceCountByDomain(ctx context.Context, svcIDToNonVerKey map[string]string, resp chan datasource.GetInstanceCountByDomainResponse) {
ret := datasource.GetInstanceCountByDomainResponse{}
domain := util.ParseDomain(ctx)
project := util.ParseProject(ctx)
- for _, sid := range svcIDToNonVerKey {
+ for sid := range svcIDToNonVerKey {
filter := mutil.NewDomainProjectFilter(domain, project, mutil.InstanceServiceID(sid))
num, err := dao.CountInstance(ctx, filter)
if err != nil {