遇到同样的错误。这代码有问题吗? const cloud = require('wx-server-sdk') cloud.init({ // API 调用都保持和云函数当前所在环境一致 env: cloud.DYNAMIC_CURRENT_ENV }) const db = cloud.database() const MAX_LIMIT = 1000 exports.main = async (event, context) => { // 获取当天 0 点的时间戳 const today = new Date(new Date().setHours(0, 0, 0, 0)) / 1000; // 先取出集合记录总数 const countResult = await db.collection('Task') .where({LastModifiedDate:db.command.gt(today)}) .count() const total = countResult.total console.log(total) // 计算需分几次取 const batchTimes = Math.ceil(total / 1000) // 承载所有读操作的 promise 的数组 const tasks = [] for (let i = 0; i < batchTimes; i++) { const promise = db.collection('Task') .where({LastModifiedDate:db.command.gt(today)}) .skip(i * MAX_LIMIT).limit(MAX_LIMIT).get() tasks.push(promise) } // 等待所有 return (await Promise.all(tasks)).reduce((acc, cur) => { return { data: acc.data.concat(cur.data), errMsg: acc.errMsg, } }) }
2020-01-16 18:11 云函数定时任务报了一波错误,具体报错详情见下面错误信息更新备注:的确使用了 promise.all + reduce 方法取出的全量数据,但是目前库里只有3条数据,还是会偶发性的报 -501004; 18:11 分 集中报了一波错,大概 14 条: { "message": "errCode: -501004 exceed concurrent request limit | errMsg: [LimitExceeded.NoValidConnection] Connection num overrun. Please improve specifications, but if the problem cannot be solved, contact us.; ", "name": "", "stack": "Error: errCode: -501004 exceed concurrent request limit | errMsg: [LimitExceeded.NoValidConnection] Connection num overrun. Please improve specifications, but if the problem cannot be solved, contact us.; \n at Object.returnAsCloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6052:16)\n at Object.checkError (/var/user/node_modules/wx-server-sdk/index.js:1378:23)\n at Promise (/var/user/node_modules/wx-server-sdk/index.js:1508:33)\n at \n at process._tickCallback (internal/process/next_tick.js:188:7)", "userInfo": { "appId": "wx4bfbc8e64eff19eb" } } 然后登陆云函数后台查看日志发现,下面提示 日志内容 Request ID: 4c830adf-14b7-4fff-b2cd-3487add8034f 执行时间: 9372.41ms内存使用: 37.93 MB 返回结果 null 日志 START RequestId: 4c830adf-14b7-4fff-b2cd-3487add8034f Event RequestId: 4c830adf-14b7-4fff-b2cd-3487add8034f 2020-01-16T10:11:53.154Z Database operation database.queryDocument is longer than 3s. Please check query performance and your network environment. END RequestId: 4c830adf-14b7-4fff-b2cd-3487add8034f Report RequestId: 4c830adf-14b7-4fff-b2cd-3487add8034f Duration:9372ms Memory:256MB MaxMemoryUsed:37.929688MB 大概从 17: 57 开始,执行时间由 70ms 升到 3、4 秒,中间甚至十几秒,到 18: 11 分后定时任务停止。 [图片][图片][图片]
2020-03-04昨天出现这样的问题,今天又可以了
wx.chooseLocation传入目标地经纬度后,安卓机上显示的距离不正确?wx.chooseLocation传入目标地经纬度后,在安卓机上显示的距离不正确,距离一万多公里,苹果机上正常; 使用方式如下: 方法:wx.chooseLocation({latitude:22.71991,longitude:114.24779}); 不穿目标地经纬度;安卓机:正常;苹果机:正常; 传入目标地经纬度:安卓机:地图显示正常,列表距离不正常;苹果:均正常; 图片: [图片] [图片]
2019-12-24