我们在wx.request的fail回调里,将request失败的信息都记录到日志里了,在日志里时不时出现请求超时的错误。
小程序记录代码:
fail: res => {
if (res.errMsg.indexOf('request:fail') >= 0) {
wx.showToast({
title: '当前网络状况不佳',
icon: 'none'
})
}
wx.request({
url: api.domain + api.tools.errorColl,
method: 'POST',
data: {
'message': '请求fail:' + options.url + ',params:' + JSON.stringify(options.data) + ',error_info' + JSON.stringify(res),
},
});
reject(res);
}
业务日志
2020-04-01T18:05:36+08:00 ] NOTIC: :请求fail:/kf/unread_cnt,params:{"wxa_sessid":"w5e6eeea7c38a919302b14df6842668081-ba","appid":"",,error_info{"errMsg":"request:fail 请求超时。"}
web服务器访问日志,查询的是这个接口在这段时间内的所有记录
- - [01/Apr/2020:18:02:14 +0800] "/kf/unread_cnt" 0.014 0.000 0.008 POST /kf/unread_cnt HTTP/1.1 200 192 "https://servicewechat.com//7/page-frame.html" "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.12(0x17000c27) NetType/WIFI Language/zh_CN" -
- - [01/Apr/2020:18:02:21 +0800] "/kf/unread_cnt" 0.023 0.000 0.008 POST /kf/unread_cnt HTTP/1.1 200 191 "https://servicewechat.com//7/page-frame.html" "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.12(0x17000c27) NetType/WIFI Language/zh_CN" -
- - [01/Apr/2020:18:16:30 +0800] "/kf/unread_cnt" 0.018 0.000 0.008 POST /kf/unread_cnt HTTP/1.1 200 192 "https://servicewechat.com//7/page-frame.html" "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.12(0x17000c27) NetType/WIFI Language/zh_CN" -
web错误日志最晚的一条也在这个时间点之前
appid:wxdc1221fa620ac61b
同上,请问找到原因和解决办法了 么?