Skip to content

Commit

Permalink
fix(monitor): remove the close of monitors
Browse files Browse the repository at this point in the history
No need to close the monitors after deleting a node resource.
If a node is gone, monitor will return error and won't continue the following tasks.

Longhorn 10035

Signed-off-by: Derek Su <[email protected]>
  • Loading branch information
derekbit committed Dec 24, 2024
1 parent a65a6ce commit 718b6b4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
1 change: 0 additions & 1 deletion controller/monitor/disk_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ func (m *DiskMonitor) GetCollectedData() (interface{}, error) {
func (m *DiskMonitor) run(value interface{}) error {
node, err := m.ds.GetNode(m.nodeName)
if err != nil {
logrus.WithError(err).Errorf("Failed to get longhorn node %v", m.nodeName)
return errors.Wrapf(err, "failed to get longhorn node %v", m.nodeName)
}

Expand Down
16 changes: 0 additions & 16 deletions controller/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,22 +375,6 @@ func (nc *NodeController) syncNode(key string) (err error) {

if node.DeletionTimestamp != nil {
nc.eventRecorder.Eventf(node, corev1.EventTypeWarning, constant.EventReasonDelete, "Deleting node %v", node.Name)

if nc.diskMonitor != nil {
nc.diskMonitor.Stop()
nc.diskMonitor = nil
}

if nc.environmentCheckMonitor != nil {
nc.environmentCheckMonitor.Stop()
nc.environmentCheckMonitor = nil
}

if nc.snapshotMonitor != nil {
nc.snapshotMonitor.Stop()
nc.snapshotMonitor = nil
}

return nc.ds.RemoveFinalizerForNode(node)
}

Expand Down

0 comments on commit 718b6b4

Please sign in to comment.