add async timeout

This commit is contained in:
Donghuang 2021-09-13 19:26:18 +08:00
parent 20afc2369c
commit 2dcc09c384
2 changed files with 6 additions and 2 deletions

View File

@ -19,7 +19,7 @@ public class YoServer implements WebMvcConfigurer {
@Autowired
private ThreadPoolTaskExecutor executor;
@Value("${yo.server.web-async-timeout:50000}")
@Value("${yo.server.web-async-timeout:48000}")
private Long webAsyncTimeout;
/**

View File

@ -13,6 +13,7 @@ import com.pudonghot.yo.model.exception.ErrorCode;
import com.pudonghot.yo.openapi.auth.SessionAbility;
import com.pudonghot.yo.service.CommonAgentStatusService;
import com.pudonghot.yo.openapi.service.AgentEventService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.request.async.DeferredResult;
@ -29,6 +30,8 @@ public class AgentEventController implements SessionAbility {
private CommonAgentStatusService agentStatusService;
@Autowired
private AgentEventService agentEventService;
@Value("${yo.server.web-async-timeout:48000}")
private Long webAsyncTimeout;
@RequestMapping("/resource/agentevent/{account}")
public DeferredResult<?> agentEvent(
@ -41,7 +44,8 @@ public class AgentEventController implements SessionAbility {
new Search(Agent.TENANT_ID, getTenantId())
.eq(Agent.ACCOUNT, account));
val result = new DeferredResult<Object>();
val result = new DeferredResult<Object>(webAsyncTimeout);
if (agent == null) {
result.setResult(errorModel(ErrorCode.AGENT_NOT_FOUND));
return result;