wendux / DSBridge-Android

:earth_americas: A modern cross-platform JavaScript bridge, through which you can invoke each other's functions synchronously or asynchronously between JavaScript and native.
3.73k stars 613 forks source link

频繁请求出现okhttp超时 #141

Open yangwubo0800 opened 4 years ago

yangwubo0800 commented 4 years ago

E/AjaxHandler: okHttpClient:在线接口返回失败 IOException = Failed to connect to XXXXXX; android.system.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)

建议作者将demo中的AjaxHandler类中的 okHttpClient 对象改成静态或者单例,不要在try catch 中每次去new, 这边测试发现当前端频繁请求拦截到AjaxHandler中处理OKHttp 请求时,容易出现如上报错,连接超时,怀疑是多个client对象导致的问题,将其改为静态变量后,测试没有复现。