收藏
回答

如果排查解决小程序卡死的状态?

你好,目前项目需求是在小程序进入后台模式后 蓝牙设备回传数据请求服务器异步保存

因为目前蓝牙设备请求频次比较高,接口需要的登录态是直接从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


回答关注问题邀请回答
收藏

1 个回答

  • 派大星
    派大星
    2019-08-15

    后台模式中 没有操作任何页面对象(包括页面跳转、页面控件的调整等etc...) 目前想到的方案就是不频繁去请求服务器,使用批量的方式等数据达到某一个设定的阀值之后再去批量保存 减少后台模式网络请求,登录态的问题是否可以在小程序启动后直接取值一次保存到全局变量

    就是如果用户在后台模式下强行杀掉进程会导致数据会有丢失的问题


    ps:前台模式下没有问题。

    2019-08-15
    有用
    回复
登录 后发表内容
问题标签