chore(node): add timing logs and improve node status diagnostics

- master: add TIMING logs in setWorkerNodeOnline to mark start and completed DB update
- handler: log node status for reconnection debugging and include active/enabled values in "node not active or enabled" error
This commit is contained in:
Marvin Zhang
2025-10-20 11:14:55 +08:00
parent 49165b2165
commit 6020fef30b
2 changed files with 9 additions and 1 deletions

View File

@@ -252,6 +252,8 @@ func (svc *MasterService) setWorkerNodeOnline(node *models.Node) {
return
}
svc.Infof("[TIMING] Starting setWorkerNodeOnline for node[%s]", node.Key)
oldStatus := node.Status
node.Status = constants.NodeStatusOnline
node.Active = true
@@ -264,6 +266,8 @@ func (svc *MasterService) setWorkerNodeOnline(node *models.Node) {
return
}
svc.Infof("[TIMING] Completed database update for node[%s] - Active=%v, Enabled=%v, Status=%s",
node.Key, node.Active, node.Enabled, node.Status)
svc.Infof("worker node[%s] status changed from '%s' to 'online'", node.Key, oldStatus)
// send notification if status changed

View File

@@ -217,9 +217,13 @@ func (svc *Service) processFetchCycle() error {
return fmt.Errorf("failed to get current node: %w", err)
}
// Log node status for debugging reconnection issues
svc.Debugf("[TIMING] Node status check: Active=%v, Enabled=%v, Status=%s",
n.Active, n.Enabled, n.Status)
// skip if node is not active or enabled
if !n.Active || !n.Enabled {
return fmt.Errorf("node not active or enabled")
return fmt.Errorf("node not active or enabled (active=%v, enabled=%v)", n.Active, n.Enabled)
}
// validate if max runners is reached (max runners = 0 means no limit)