您可以使用
Promise.race超时:
Promise.race([ doSomethingInSeries(), new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), 11.5e3))]).catch(function(err) { // errors in res1, res2, res3 and the timeout will be caught here})您必须
setTimeout将其包装在诺言中才能使用。



