refactor: update method receivers to value type for cleanup and connection methods; enhance context usage for task client operations

This commit is contained in:
Marvin Zhang
2025-08-07 11:53:42 +08:00
parent f5f83a010f
commit e1251d808b
3 changed files with 13 additions and 7 deletions

View File

@@ -162,7 +162,10 @@ func (svc *WorkerService) subscribe() {
svc.Errorf("failed to get node client: %v", err)
return err
}
stream, err := nodeClient.Subscribe(context.Background(), &grpc.NodeServiceSubscribeRequest{
// Use client context for proper cancellation
ctx, cancel := client.GetGrpcClient().Context()
defer cancel()
stream, err := nodeClient.Subscribe(ctx, &grpc.NodeServiceSubscribeRequest{
NodeKey: svc.cfgSvc.GetNodeKey(),
})
if err != nil {