Skip to content

Commit

Permalink
clone instance before publish
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewshan committed Mar 19, 2023
1 parent fbab67a commit f011153
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions service/healthcheck/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"sync"
"time"

"github.com/golang/protobuf/proto"
apimodel "github.com/polarismesh/specification/source/go/api/v1/model"
apiservice "github.com/polarismesh/specification/source/go/api/v1/service_manage"

Expand Down Expand Up @@ -214,6 +215,9 @@ func (s *Server) RecordHistory(entry *model.RecordEntry) {
// publishInstanceEvent 发布服务事件
func (s *Server) publishInstanceEvent(serviceID string, event model.InstanceEvent) {
event.SvcId = serviceID
if nil != event.Instance {
event.Instance = proto.Clone(event.Instance).(*apiservice.Instance)
}
eventhub.Publish(eventhub.InstanceEventTopic, event)
}

Expand Down

0 comments on commit f011153

Please sign in to comment.