Skip to content

Commit

Permalink
remove unnecessary memory allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
sdojjy committed Aug 22, 2024
1 parent 1cd9fa8 commit 7fe01f6
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions maintainer/maintainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,16 +442,6 @@ func (m *Maintainer) onHeartBeatRequest(msg *messaging.TargetMessage) error {
if req.Watermark != nil {
m.checkpointTsByCapture[model.CaptureID(msg.From)] = *req.Watermark
}

var status []scheduler.InferiorStatus
for _, info := range req.Statuses {
status = append(status, &ReplicaSetStatus{
ID: &common.TableSpan{
TableSpan: info.Span,
},
State: info.ComponentStatus,
})
}
msgs, err := m.scheduler.HandleStatus(msg.From.String(), req.Statuses)
if err != nil {
log.Error("handle status failed, ignore",
Expand All @@ -460,14 +450,16 @@ func (m *Maintainer) onHeartBeatRequest(msg *messaging.TargetMessage) error {
return errors.Trace(err)
}
m.sendMessages(msgs)
m.errLock.Lock()
if req.Warning != nil {
m.errLock.Lock()
m.runningWarnings[msg.From] = req.Warning
m.errLock.Unlock()
}
if req.Err != nil {
m.errLock.Unlock()
m.runningErrors[msg.From] = req.Err
m.errLock.Unlock()
}
m.errLock.Unlock()
return nil
}

Expand Down

0 comments on commit 7fe01f6

Please sign in to comment.