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 2020/11/19 08:13:19 UTC

[GitHub] [servicecomb-service-center] robotLJW opened a new pull request #748: SCB-2094 Implement of Mongo heartbeat interface

robotLJW opened a new pull request #748:
URL: https://github.com/apache/servicecomb-service-center/pull/748


   ## SCB-2094 Implement of Mongo heartbeat interface


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [servicecomb-service-center] tianxiaoliang merged pull request #748: SCB-2094 Implement of Mongo heartbeat interface

Posted by GitBox <gi...@apache.org>.
tianxiaoliang merged pull request #748:
URL: https://github.com/apache/servicecomb-service-center/pull/748


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [servicecomb-service-center] robotLJW commented on pull request #748: SCB-2094 Implement of Mongo heartbeat interface

Posted by GitBox <gi...@apache.org>.
robotLJW commented on pull request #748:
URL: https://github.com/apache/servicecomb-service-center/pull/748#issuecomment-730236765


   @little-cui
   @Shawn


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #748: SCB-2094 Implement of Mongo heartbeat interface

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #748:
URL: https://github.com/apache/servicecomb-service-center/pull/748#discussion_r526730277



##########
File path: datasource/mongo/heartbeat/heartbeatchecker/heartbeat.go
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package heartbeatchecker
+
+import (
+	"context"
+	"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"
+	"time"
+)
+
+func updateInstanceRefreshTime(ctx context.Context, serviceID string, instanceID string) error {
+	filter := bson.M{
+		mongo.InstanceID: instanceID,
+		mongo.ServiceID:  serviceID,
+	}
+	update := bson.M{
+		"$set": bson.M{mongo.RefreshTime: time.Now()},
+	}
+	result, err := client.GetMongoClient().FindOneAndUpdate(ctx, mongo.CollectionInstance, filter, update)
+	if err != nil {
+		log.Errorf(err, "failed to update intance : ")

Review comment:
       这个冒号不要前面空格




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #748: SCB-2094 Implement of Mongo heartbeat interface

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #748:
URL: https://github.com/apache/servicecomb-service-center/pull/748#discussion_r526730277



##########
File path: datasource/mongo/heartbeat/heartbeatchecker/heartbeat.go
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package heartbeatchecker
+
+import (
+	"context"
+	"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"
+	"time"
+)
+
+func updateInstanceRefreshTime(ctx context.Context, serviceID string, instanceID string) error {
+	filter := bson.M{
+		mongo.InstanceID: instanceID,
+		mongo.ServiceID:  serviceID,
+	}
+	update := bson.M{
+		"$set": bson.M{mongo.RefreshTime: time.Now()},
+	}
+	result, err := client.GetMongoClient().FindOneAndUpdate(ctx, mongo.CollectionInstance, filter, update)
+	if err != nil {
+		log.Errorf(err, "failed to update intance : ")

Review comment:
       这个冒号不好前面空格




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [servicecomb-service-center] little-cui commented on a change in pull request #748: SCB-2094 Implement of Mongo heartbeat interface

Posted by GitBox <gi...@apache.org>.
little-cui commented on a change in pull request #748:
URL: https://github.com/apache/servicecomb-service-center/pull/748#discussion_r526706876



##########
File path: datasource/mongo/heartbeat/heartbeatchecker/heartbeat.go
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package heartbeatchecker
+
+import (
+	"context"
+	"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"
+	"time"
+)
+
+func updateInstanceRefreshTime(ctx context.Context, serviceID string, instanceID string) error {
+	filter := bson.M{
+		mongo.InstanceID: instanceID,
+		mongo.ServiceID:  serviceID,
+	}
+	update := bson.M{
+		"$set": bson.M{mongo.RefreshTime: time.Now()},
+	}
+	result, err := client.GetMongoClient().FindOneAndUpdate(ctx, mongo.CollectionInstance, filter, update)

Review comment:
       这里只能支持60个?写一个注释吧




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [servicecomb-service-center] robotLJW commented on a change in pull request #748: SCB-2094 Implement of Mongo heartbeat interface

Posted by GitBox <gi...@apache.org>.
robotLJW commented on a change in pull request #748:
URL: https://github.com/apache/servicecomb-service-center/pull/748#discussion_r526760430



##########
File path: datasource/mongo/heartbeat/heartbeatchecker/heartbeat.go
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package heartbeatchecker
+
+import (
+	"context"
+	"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"
+	"time"
+)
+
+func updateInstanceRefreshTime(ctx context.Context, serviceID string, instanceID string) error {
+	filter := bson.M{
+		mongo.InstanceID: instanceID,
+		mongo.ServiceID:  serviceID,
+	}
+	update := bson.M{
+		"$set": bson.M{mongo.RefreshTime: time.Now()},
+	}
+	result, err := client.GetMongoClient().FindOneAndUpdate(ctx, mongo.CollectionInstance, filter, update)
+	if err != nil {
+		log.Errorf(err, "failed to update intance : ")

Review comment:
       done




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [servicecomb-service-center] robotLJW edited a comment on pull request #748: SCB-2094 Implement of Mongo heartbeat interface

Posted by GitBox <gi...@apache.org>.
robotLJW edited a comment on pull request #748:
URL: https://github.com/apache/servicecomb-service-center/pull/748#issuecomment-730236765


   @little-cui
   @tianxiaoliang


----------------------------------------------------------------
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:
users@infra.apache.org