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 2019/03/25 07:59:21 UTC
[servicecomb-service-center] branch master updated: Add some
comments
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/servicecomb-service-center.git
The following commit(s) were added to refs/heads/master by this push:
new 2a60d63 Add some comments
2a60d63 is described below
commit 2a60d6370a3ad85bb52fa1d63c541888b16629f6
Author: little-cui <su...@qq.com>
AuthorDate: Mon Mar 25 15:59:17 2019 +0800
Add some comments
---
server/service/instance.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/server/service/instance.go b/server/service/instance.go
index cd95050..e67d64e 100644
--- a/server/service/instance.go
+++ b/server/service/instance.go
@@ -103,6 +103,11 @@ func (s *InstanceService) Register(ctx context.Context, in *pb.RegisterInstanceR
//允许自定义id
if len(instance.InstanceId) > 0 {
// keep alive the lease ttl
+ // there are two reasons for sending a heartbeat here:
+ // 1. in the scenario the instance has been removed,
+ // the cast of registration operation can be reduced.
+ // 2. in the self-protection scenario, the instance is unhealthy
+ // and needs to be re-registered.
resp, err := s.Heartbeat(ctx, &pb.HeartbeatRequest{ServiceId: instance.ServiceId, InstanceId: instance.InstanceId})
switch resp.Response.Code {
case pb.Response_SUCCESS: