我一个云函数里嵌套执行了另外三个云函数,总时长没超过3秒,但是超时报错。我发现这样的情况出现概率也不低,是不是云函数嵌套执行机制有问题?
报错如下:
日志内容 Request ID: d3f2dcec-73b7-11ea-af58-5254006250a6
执行时间: 3000ms内存使用: 36.29 MB
返回结果
{"errorCode":-1,"errorMessage":"Task timed out after 3 seconds"}
日志
START RequestId: d3f2dcec-73b7-11ea-af58-5254006250a6
Event RequestId: d3f2dcec-73b7-11ea-af58-5254006250a6
ERROR RequestId:d3f2dcec-73b7-11ea-af58-5254006250a6 Result:{"errorCode":-1,"errorMessage":"Task timed out after 3 seconds"}
END RequestId: d3f2dcec-73b7-11ea-af58-5254006250a6
Report RequestId: d3f2dcec-73b7-11ea-af58-5254006250a6 Duration:3000ms Memory:256MB MemUsage:36.292969MB
源码如下:
exports.main = async (event, context) => {
//少量数据库查询与修改,耗时可控,肯定少于1000ms
db...
//日志显示耗时188ms
await cloud.callFunction({
name: 'f1'
}
//日志型显示耗时70ms
await cloud.callFunction({
name: 'f1'
}
//日志显示耗时428ms
await cloud.callFunction({
name: 'f2'
}
}
环境名:mr-z-release
函数名:setOrderPackage