fix: improve logging in master and worker services

- Added logging for error handling in the MasterService when setting a worker node offline, replacing the previous trace.PrintError with a more informative log message.
- Enhanced WorkerService subscription method with debug logs to indicate subscription attempts and status, improving traceability during connection processes.
This commit is contained in:
Marvin Zhang
2024-12-29 19:19:36 +08:00
parent 54800974eb
commit ef499a03e0
2 changed files with 5 additions and 2 deletions

View File

@@ -145,11 +145,13 @@ func (svc *WorkerService) subscribe() {
for {
if svc.stopped {
svc.Infof("subscription stopped. exiting...")
return
}
// Use backoff for connection attempts
operation := func() error {
svc.Debugf("attempting to subscribe to master")
stream, err := client.GetGrpcClient().NodeClient.Subscribe(context.Background(), &grpc.NodeServiceSubscribeRequest{
NodeKey: svc.cfgSvc.GetNodeKey(),
})
@@ -157,6 +159,7 @@ func (svc *WorkerService) subscribe() {
svc.Errorf("failed to subscribe to master: %v", err)
return err
}
svc.Debugf("subscribed to master")
// Handle messages
for {