【发布时间】:2023-04-11 06:50:01
【问题描述】:
假设我们需要在出现异常时重试请求:
public class TestUpInterceptor implements Interceptor {
@Override public Response intercept(Chain chain) throws IOException {
final Response response = chain.proceed(chain.request());
//TODO: in case of exception retry in 3 sec
return retryResponse;
}
}
如何给拦截器添加延迟?
【问题讨论】:
-
您是否真的要重复您的请求,或者您只是担心在不完整的 Internet 情况下它可能会失败? Coz you dont really need to worry about the latter
-
@ZeekHuge 我想再说一遍