fix(workflow): 修复子流程批量执行缓存键冲突
递归识别子工作流中的视频模型以支持 per_second 计费,并为子流程批量子执行添加 SubFlowScope 隔离 async/segment 缓存键。
This commit is contained in:
@@ -61,12 +61,18 @@ func SubFlowLambda(ctx context.Context, input any) (any, error) {
|
||||
configMap := buildConfigMap(getRes.FlowContent, nodeList)
|
||||
batchInputs := make([]*flowDto.FlowExecutionInput, 0, batchCount)
|
||||
for j := 0; j < batchCount; j++ {
|
||||
// 缓存作用域:拼本(外层)子流程节点 Id + 份号 j,供 async/segment 缓存键隔离各份
|
||||
// (同一 exec 下 N 份内层节点 id 相同,无作用域会互相命中/覆盖 done 结果,见《工作流子流程批量缓存隔离设计.md》)。
|
||||
// 嵌套子流程继承父 scope(Global.SubFlowScope)递归叠加,保证跨 exec/嵌套路径唯一;
|
||||
// 跨 launch 续跑按同序重放 batch → 各份 scope 稳定,仍能命中自己那份结果。
|
||||
scope := nodeExecInput.Global.SubFlowScope + fmt.Sprintf("[%s#%d]", nodeExecInput.Config.Id, j)
|
||||
batchInputs = append(batchInputs, &flowDto.FlowExecutionInput{
|
||||
NodeGroupId: nodeExecInput.Global.NodeGroupId,
|
||||
ExecutionId: nodeExecInput.Global.ExecutionId,
|
||||
FlowId: nodeExecInput.Global.FlowId,
|
||||
ConfigMap: cloneConfigMap(configMap),
|
||||
SessionId: nodeExecInput.Global.SessionId,
|
||||
NodeGroupId: nodeExecInput.Global.NodeGroupId,
|
||||
ExecutionId: nodeExecInput.Global.ExecutionId,
|
||||
FlowId: nodeExecInput.Global.FlowId,
|
||||
ConfigMap: cloneConfigMap(configMap),
|
||||
SessionId: nodeExecInput.Global.SessionId,
|
||||
SubFlowScope: scope,
|
||||
})
|
||||
}
|
||||
// 7. 执行批量子流程
|
||||
|
||||
Reference in New Issue
Block a user