你好,目前项目需求是在小程序进入后台模式后 蓝牙设备回传数据请求服务器异步保存
因为目前蓝牙设备请求频次比较高,接口需要的登录态是直接从storage获取的
在经历一段时间10分钟左右 (一秒大概会有5-10个wx.request的请求每次请求的时候都会从stroage获取登录态信息)
小程序进入前台模式后,页面响应卡顿,点击没有反应,或者跳转页面后无法请求服务器等等…
一下是真机调试下miniprogramLog目录的日志片段:
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
2019-8-15 10:4:32 [log] wx.getStorageSync api invoke
2019-8-15 10:4:32 [log] wx.getStorageSync return
2019-8-15 10:4:32 [log] wx.request api invoke with seq 0
在整个这个后台模式操作中,就是使用了storage频繁获取登录态信息 以及频繁调用wx.request