0

我正在对我的 nodejs 应用程序进行压力测试,测试基本上同时发送大量请求,有时我会遇到这个烦人的错误:

{ RequestError: Error: connect ECONNREFUSED 127.0.0.1:1234
at new RequestError (/mnt/c/Users/rawhi/Desktop/myCode/backend/api/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/mnt/c/Users/rawhi/Desktop/myCode/backend/api/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/mnt/c/Users/rawhi/Desktop/myCode/backend/api/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/mnt/c/Users/rawhi/Desktop/myCode/backend/api/node_modules/request/request.js:185:22)
at Request.emit (events.js:198:13)
at Request.onRequestError (/mnt/c/Users/rawhi/Desktop/myCode/backend/api/node_modules/request/request.js:881:8)
at ClientRequest.emit (events.js:198:13)
at Socket.socketErrorListener (_http_client.js:392:9)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
name: 'RequestError',
message: 'Error: connect ECONNREFUSED 127.0.0.1:1234',
cause:
{ Error: connect ECONNREFUSED 127.0.0.1:1234
   at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
 errno: 'ECONNREFUSED',
 code: 'ECONNREFUSED',
 syscall: 'connect',
 address: '127.0.0.1',
 port: 1234 }

因此,测试不断为“几乎”所有请求返回此错误,但我仍然可以通过邮递员发送请求而没有任何问题。谁能解释一下这里有什么问题?以及如何解决?喜欢使用队列代理或其他有用的东西?
提前致谢

4

0 回答 0