RetryableException解析

项目场景

跨服务调用报错:feign.RetryableException:xxx executing POST

源码

当Response被认为是可重试时会引发此异常,通常在状态为503时通过feign.codec.ErrorDecoder进行

public class RetryableException extends FeignException {

  private static final long serialVersionUID = 1L;

  private final Long retryAfter;
  private final HttpMethod httpMethod;

  /**
   * @param retryAfter usually corresponds to the {@link feign.Util#RETRY_AFTER} header.
   */
  public RetryableException(int status, String message, HttpMethod httpMethod, Throwable cause,
      Date retryAfter, Request request) {
    super(status, message, request, cause);
    this.httpMethod = httpMethod;
    this.retryAfter = retryAfter != null ? retryAfter.getTime() : null;
  }

  /**
   * @param retryAfter usually corresponds to the {@link feign.Util#RETRY_AFTER} header.
   */
  public RetryableException(int status, String message, HttpMethod httpMethod, Date retryAfter,
      Request request) {
    super(status, message, request);
    this.httpMethod = httpMethod;
    this.retryAfter = retryAfter != null ? retryAfter.getTime() : null;
  }

  /**
   * Sometimes corresponds to the {@link feign.Util#RETRY_AFTER} header present in {@code 503}
   * status. Other times parsed from an application-specific response. Null if unknown.
   */
  public Date retryAfter() {
    return retryAfter != null ? new Date(retryAfter) : null;
  }

  public HttpMethod method() {
    return this.httpMethod;
  }
}

FeignClientProperties的config属性

FeignClientProperties是Feign客户端的配置类,对应我们在yml中的feign.client。我们可以通过配置connectTimeout和readTimeout的大戏
在这里插入图片描述

解决方案

方案一
feign:
    client:
        config:
            default:
                connectTimeout: 60000
                readTimeout: 60000

方案二

运维重置ip解析
总结三个原因
	①开发和运维真的要沟通清除(我们遇到这个问题原因就是开发以为运维配置了,运维觉得如果需要配置,开发会和他沟通)
	②看日志一定要仔细(当时运维把报错日志发给我时,真没仔细看,直接就干百度,结果浪费了不少时间)
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值