[英]How to solve lint error - unexpected await inside a loop when calling aws connect api which returns a next token?
I am making calls to aws connect which returns a number of queues and a next-token to fetch the next set.我正在调用 aws connect,它返回多个队列和下一个令牌以获取下一组。 Once all the queues are returned in 'n' calls, nextToken is retuned as null which I used to terminate the do-while loop.在“n”个调用中返回所有队列后,nextToken 将重新调整为 null,我用它来终止 do-while 循环。
let token;
do{
let {queues,nextToken}= await connect.listQueues(params); //pseudo code
params['NextToken']=nextToken;
token=nextToken;
//do some processing
}while(nextToken);
All of this is working fine but lint warns that: unexpected await inside a loop.
所有这一切都工作正常,但 lint 警告说: unexpected await inside a loop.
Is there a better way to do this so that I avoid the lint error and also achieve what I am trying to do here?有没有更好的方法来做到这一点,这样我就可以避免 lint 错误并实现我在这里想要做的事情?
ended up disabling the eslint rule.最终禁用了 eslint 规则。
/*eslint-disable no-await-in-for-loop eslint-disable *\
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.