不在异步瀑布中调用最终回调有什么坏处吗?

Is there any harm to not calling the final callback in an Async waterfall?

async.waterfall(
  [
  function(cb){
    //do some stuff and then never call cb leaving the async waterfall unfinished
  },...],
  function(err,result){
     //we only get here if the cb is called above and it never is
  }
)

这样做有什么坏处吗?我意识到它没有使用设计的方法,但我只是发现了一堆我正在维护的代码(由不再被大吼大叫的人编写的)我担心这实际上可能会使事情陷入困境。如果这是 运行 在受到严重攻击的服务器上,它会产生问题吗?

您需要回调 final 函数,否则它不会 return 到其调用代码。或者将回调嵌套在彼此内部或使用 promises。如果您不 return 回调,那么事件循环将被阻止。