Commit 9953bfb3 authored by zhouwei's avatar zhouwei

设置请求超时

parent fb31b6af
...@@ -12,7 +12,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -12,7 +12,7 @@ import org.springframework.context.annotation.Configuration;
public class AppConfig { public class AppConfig {
@Value("${alert.host}") @Value("${alert.host}")
String alertHost; String alertHost;
@Value("${gateway.request.timeout:30000}") @Value("${gateway.request.timeout:180000}")
private Integer requestTimeout; private Integer requestTimeout;
@Value("${gateway.window.time:600000}") @Value("${gateway.window.time:600000}")
......
...@@ -317,6 +317,7 @@ public class FailoverGatewayFilterFactory extends AbstractGatewayFilterFactory<F ...@@ -317,6 +317,7 @@ public class FailoverGatewayFilterFactory extends AbstractGatewayFilterFactory<F
return requestBodySpec return requestBodySpec
.exchange() .exchange()
.timeout(Duration.ofMillis(requestTimeout))
.flatMap(clientResponse -> handleResponse(exchange, clientResponse, isSourceRequest, errorStats)) .flatMap(clientResponse -> handleResponse(exchange, clientResponse, isSourceRequest, errorStats))
.doFinally(signalType -> { .doFinally(signalType -> {
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment