在缓存任务键值中增加集群信息,以便于调试问题

This commit is contained in:
GoEdgeLab
2024-03-10 11:26:28 +08:00
parent 10c826af18
commit 1d8f341b46

View File

@@ -353,6 +353,19 @@ func (this *HTTPCacheTaskService) FindEnabledHTTPCacheTask(ctx context.Context,
key.Errors = nil
}
// 集群信息
var pbNodeCluster *pb.NodeCluster
if !isFromUser && key.ClusterId > 0 {
clusterName, findClusterErr := models.SharedNodeClusterDAO.FindNodeClusterName(tx, int64(key.ClusterId))
if findClusterErr != nil {
return nil, findClusterErr
}
pbNodeCluster = &pb.NodeCluster{
Id: int64(key.ClusterId),
Name: clusterName,
}
}
pbKeys = append(pbKeys, &pb.HTTPCacheTaskKey{
Id: int64(key.Id),
TaskId: int64(key.TaskId),
@@ -361,6 +374,7 @@ func (this *HTTPCacheTaskService) FindEnabledHTTPCacheTask(ctx context.Context,
IsDone: key.IsDone,
IsDoing: !key.IsDone && len(key.DecodeNodes()) > 0,
ErrorsJSON: key.Errors,
NodeCluster: pbNodeCluster,
})
}