little-cui commented on a change in pull request #759:
URL:
https://github.com/apache/servicecomb-service-center/pull/759#discussion_r532056244
##########
File path: datasource/mongo/heartbeat/heartbeatchecker/heartbeat.go
##########
@@ -19,24 +19,25 @@ package heartbeatchecker
import (
"context"
+ "fmt"
"github.com/apache/servicecomb-service-center/datasource/mongo"
"github.com/apache/servicecomb-service-center/datasource/mongo/client"
- "github.com/apache/servicecomb-service-center/pkg/log"
"go.mongodb.org/mongo-driver/bson"
+ "strings"
"time"
)
func updateInstanceRefreshTime(ctx context.Context, serviceID string,
instanceID string) error {
filter := bson.M{
- mongo.InstanceID: instanceID,
- mongo.ServiceID: serviceID,
+ strings.Join([]string{mongo.ColumnInstanceInfo,
mongo.ColumnInstanceID}, "."): instanceID,
Review comment:
如果只是3个字符相加,不需要使用strings.Join,编译器会优化
##########
File path: datasource/mongo/account.go
##########
@@ -33,15 +34,15 @@ import (
func (ds *DataSource) CreateAccount(ctx context.Context, a *rbacframe.Account)
error {
exist, err := ds.AccountExist(ctx, a.Name)
if err != nil {
- log.Errorf(err, "can not save account info")
+ fmt.Println("can not save account info", err)
Review comment:
不能直接打印到控制台,使用log.Error()代替
----------------------------------------------------------------
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:
[email protected]