排球请求重试策略不考虑超时

问题描述 投票:11回答:2

我在DefaultRetryPolicy中将1500设置为initialTimeoutMs,如下所示,但它不考虑超时:

request.setRetryPolicy(new DefaultRetryPolicy(1500
        , DefaultRetryPolicy.DEFAULT_MAX_RETRIES
        , DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

我断开了设备上的WiFi的连接以测试其超时,并且在Logcat中看到了这些时间:

2019-12-16 14:28:15.892 I/MyClass: request sent
2019-12-16 14:28:35.930 I/MyClass: request caught onError

[我花了超过20秒的时间,但我希望在1.5秒后捕获onResponse或onError !!!

java android android-volley request-timed-out retrypolicy
2个回答
2
投票

0
投票

使用5秒钟,因为15秒钟用于超时,因此要花费更多时间。

© www.soinside.com 2019 - 2024. All rights reserved.