Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
little-cui authored Mar 25, 2019
1 parent 55f8931 commit 2a60d63
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/service/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2a60d63

Please sign in to comment.