Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 在步骤def中递归调用promise函数时,promise返回timdeout 5000ms_Node.js_Mongodb_Typescript_Cucumber_Cucumberjs - Fatal编程技术网

Node.js 在步骤def中递归调用promise函数时,promise返回timdeout 5000ms

Node.js 在步骤def中递归调用promise函数时,promise返回timdeout 5000ms,node.js,mongodb,typescript,cucumber,cucumberjs,Node.js,Mongodb,Typescript,Cucumber,Cucumberjs,我想重复操作getRunDetailsStaus(),直到状态完成。 因此,我将条件放入.then()处理程序中,并调用递归函数next(),直到状态完成。 getStatus(runDetailsId)是一个从mongoDB返回状态的承诺函数 请参见以下我的步骤定义: 当('用户等待直到收到状态完成' let start = Date.now() function getRunDetailsStaus() { return getStatus(runDetai

我想重复操作
getRunDetailsStaus()
,直到状态完成。 因此,我将条件放入
.then()
处理程序中,并调用递归函数next(),直到状态完成。
getStatus(runDetailsId)
是一个从mongoDB返回状态的承诺函数

请参见以下我的步骤定义:

当('用户等待直到收到状态完成'

    let start = Date.now()

    function getRunDetailsStaus() {
        return getStatus(runDetailsId) //promise function and returns the status from mongoDB
    }

    function next() {
        return getRunDetailsStaus().then(function (result) {

            console.log("status: ", result.runStatus, Date.now() - start)
            if (status == 'DONE') {
                return status
            }
            else {
                return next()
            }
        })

    }

    return next()
        .then((response) => {
            // process final results
        })
        .catch((error) => {
            //process error
        })
});```

But I get the following error: 
function timed out, ensure the promise resolves within 5000 milliseconds


How should I resolve this issue in case the status done in mongo is set in ~30 min?

可能的
cucumber
config?谢谢你的提示!问题现在解决了!我在步骤定义中设置了超时:
When('user{string}等待接收状态完成',{timeout:10*10000},function(user:string){