-
Notifications
You must be signed in to change notification settings - Fork 825
Closed
Labels
Description
在servicecomb.invocation.timeout未配置时,而全链路超时时间默认取值为2倍的request.timeout,当request.timeout配置较小时(很多业务配置较小),只要客户端client filter执行时间稍微长一点,就会造成请求报408,不符合使用预期,也与历史行为不一致。
当前的代码如下:
private void guardedWait(Invocation invocation) throws InvocationException {
long wait = getWaitTime(invocation);
try {
if (wait <= 0) {
latch.await();
return;
}
if (latch.await(wait, TimeUnit.MILLISECONDS)) {
return;
}
} catch (InterruptedException e) {
//ignore
}
throw new InvocationException(REQUEST_TIMEOUT, ExceptionCodes.INVOCATION_TIMEOUT, "Invocation Timeout.");
}
private long getWaitTime(Invocation invocation) {
if (invocation.getOperationMeta().getConfig().getMsInvocationTimeout() > 0) {
return invocation.getOperationMeta().getConfig().getMsInvocationTimeout();
}
return invocation.getOperationMeta().getConfig().getMsRequestTimeout() * 2;
}
Reactions are currently unavailable