淘宝拉数据一亿条 5小时都没没看见问题?估计是自己写法问题(promise报错未捕获)异步未捕获导致的吧
That particular error occurs whenever your code attempts to send more than one response to the same request. There are a number of different coding mistakes that can lead to this:
每当您的代码尝试向同一请求发送多个响应时,就会发生该特定错误。 有许多不同的编码错误可能导致这种情况:
Improperly written asynchronous code that allows multiple branches to send a response.
编写不正确的异步代码,允许多个分支发送响应。
Not returning from the request handler to stop further code in the request handler from running after you've sent a response.
在发送响应后,不从请求处理程序返回以阻止请求处理程序中的其他代码运行。
Calling next() when you've already sent a response.
当您已发送响应时调用next()。
Improper logic branching that allows multiple code paths to execute and attempt to send a response.
不正确的逻辑分支允许多个代码路径执行并尝试发送响应。
// Testing for async errors using Promise.catch.
it('tests error with promises', () => {
expect.assertions(1);
return user.getUserName(2).catch(e =>
expect(e).toEqual({
error: 'User with 2 not found.',
}),
);
});
// Or using async/await.
it('tests error with async/await', async () => {
expect.assertions(1);
try {
await user.getUserName(1);
} catch (e) {
expect(e).toEqual({
error: 'User with 1 not found.',
});
}
});