mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-06-10 03:07:32 +08:00
enhancement #I90IRR 设置超时maxWaitSenconds之后,超时的组件仍旧执行会报出NPE的问题
This commit is contained in:
@@ -182,6 +182,16 @@ public class MaxWaitSecondsELSpringbootTest extends BaseTest {
|
||||
assertNotTimeout("chain2");
|
||||
}
|
||||
|
||||
// 测试超时情况下组件还在运行的场景是否会报错
|
||||
@Test
|
||||
public void testChain3() {
|
||||
DefaultContext context = new DefaultContext();
|
||||
context.setData("test", "123");
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain3", "arg", context);
|
||||
Assertions.assertFalse(response.isSuccess());
|
||||
Assertions.assertEquals(TimeoutException.class, response.getCause().getClass());
|
||||
}
|
||||
|
||||
private void assertTimeout(String chainId) {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp(chainId, "arg");
|
||||
Assertions.assertFalse(response.isSuccess());
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yomahub.liteflow.test.maxWaitSeconds.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.slot.DefaultContext;
|
||||
|
||||
@LiteflowComponent("e")
|
||||
public class ECmp extends NodeComponent {
|
||||
@Override
|
||||
public void process() throws Exception{
|
||||
DefaultContext context = this.getFirstContextBean();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
String str = context.getData("test");
|
||||
System.out.println(str);
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
||||
System.out.println("ECmp executed!");
|
||||
}
|
||||
}
|
||||
@@ -107,4 +107,8 @@
|
||||
<!-- 不超时 -->
|
||||
testChain.maxWaitSeconds(3);
|
||||
</chain>
|
||||
|
||||
<chain name="chain3">
|
||||
THEN(a, b, e).maxWaitSeconds(8);
|
||||
</chain>
|
||||
</flow>
|
||||
Reference in New Issue
Block a user