问题模块 框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
API和组件 微信小程序 Bug wx.request 客户端 6.7.3 2.3.2 [185]
- 当前 Bug 的表现(可附上截图)在电信或联通4G网络下,微信小程序调用wx.request网络访问超慢,需要等app.json内设置的超时时间结束后1s左右方才返回数据。如设置requestTimeOut为10s,大概10s-11s时间内返回,如设置requestTimeOut为60s,大概60s-61s时间内返回,

从ResponseHeader看,返回时间应该很短

在电信 4G或联通4G网络条件下,其他APP或WEB访问正常!
- 预期表现在移动4G网络或WIFI网络条件下,访问正常

ResponseHeader

- 复现路径使用电信或联通4G手机扫描本二维码,即可重现(超时时间设置60s)

- 提供一个最简复现 Demo
微信小程序开发问题解答
微信小程序开发者回答:
Request超时设置为20秒,在电信4G手机上做了一下时间切片, wx.request前记录了时间wx.request的success回调前记录时间,输出时间差
此时Reponse Header返回如下:

从wx.Request开始执行,到网络请求正式发出,共耗费了19.04s。这段时间微信在干什么呢?另外,从wx.Request开始执行,到网络请求正式发出的时间开销与requestTimeOut设置相关,如果我设超时时间为10s,那wx.Request开始执行到网络请求正式发出之间的时间开销大致为9s。
本文网址:http://www.91bianli.com/kaifazhinan/78773.html