diff --git a/core/node/service/master_service.go b/core/node/service/master_service.go index 6844d934..6dc7fc79 100644 --- a/core/node/service/master_service.go +++ b/core/node/service/master_service.go @@ -2,6 +2,7 @@ package service import ( "errors" + "github.com/apex/log" "github.com/cenkalti/backoff/v4" "github.com/crawlab-team/crawlab/core/constants" "github.com/crawlab-team/crawlab/core/grpc/server" @@ -17,7 +18,6 @@ import ( "github.com/crawlab-team/crawlab/core/task/scheduler" "github.com/crawlab-team/crawlab/core/utils" "github.com/crawlab-team/crawlab/grpc" - "github.com/crawlab-team/crawlab/trace" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" mongo2 "go.mongodb.org/mongo-driver/mongo" @@ -244,7 +244,7 @@ func (svc *MasterService) setWorkerNodeOffline(node *models.Node) { return service.NewModelService[models.Node]().ReplaceById(node.Id, *node) }, backoff.WithMaxRetries(backoff.NewConstantBackOff(1*time.Second), 3)) if err != nil { - trace.PrintError(err) + log.Errorf("failed to set worker node[%s] offline: %v", node.Key, err) } svc.sendNotification(node) } diff --git a/core/node/service/worker_service.go b/core/node/service/worker_service.go index ff174204..e4078118 100644 --- a/core/node/service/worker_service.go +++ b/core/node/service/worker_service.go @@ -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 {