Remove redundant result in the step context while there is no for-loop component #299

This commit is contained in:
Francis Dong
2021-09-04 22:07:31 +08:00
committed by dxfeng10
parent 4effb404b5
commit f086029b51
3 changed files with 7 additions and 8 deletions

View File

@@ -175,10 +175,7 @@ public class Pipeline {
StepContextPosition stepCtxPos = new StepContextPosition(step.getName());
return ComponentHelper.run(components, stepContext, stepCtxPos, (ctx, pos) -> {
step.beforeRun(stepContext, null);
return createStep(step).flatMap(r -> {
ctx.addStepCircleResult(pos.getStepName());
return Mono.just(r);
});
return createStep(step);
}).flatMap(sr -> {
if (sr instanceof ComponentResult) {
return Mono.just(stepResponse);

View File

@@ -141,10 +141,7 @@ public class Step {
StepContextPosition stepCtxPos = new StepContextPosition(name, requestName);
Mono<Object> result = ComponentHelper.run(components, stepContext, stepCtxPos, (ctx, pos) -> {
if (input.needRun(ctx)) {
return input.run().flatMap(r -> {
ctx.addRequestCircleResult(pos.getStepName(), pos.getRequestName());
return Mono.just(r);
});
return input.run();
}
return Mono.just(new HashMap());
}).flatMap(r -> {

View File

@@ -288,6 +288,11 @@ public class Circle implements IComponent {
return Mono.just(new CircleItemResult(ctxNode, nextItem2, null));
}
return f.apply(stepContext, stepCtxPos).flatMap(r -> {
if (stepCtxPos.getRequestName() != null) {
stepContext.addRequestCircleResult(stepCtxPos.getStepName(), stepCtxPos.getRequestName());
} else {
stepContext.addStepCircleResult(stepCtxPos.getStepName());
}
ONode ctxNode2 = ComponentHelper.toONode(stepContext);
if (this.breakCircle(cItem.getIndex(), ctxNode2, stepContext, stepCtxPos)) {
return Mono.empty();