-
Notifications
You must be signed in to change notification settings - Fork 358
Add retry mechanism #1068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add retry mechanism #1068
Conversation
lib/policies/proxy/proxy.js
Outdated
|
|
||
| const retryCountMap = {}; | ||
| const proxy = httpProxy.createProxyServer(Object.assign(params, proxyOptions)); | ||
| // when http request suucess,clear map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will delete it
lib/policies/proxy/proxy.js
Outdated
| if (retryCount < maxAutoRetries) { | ||
| retryCount++; | ||
| retryCountMap[requestID] = retryCount; | ||
| // console.log(`retry count: ${retryCount} `, req.originalUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete console.logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will delete it
|
I checked and found that the test error was due to the resources in the test case being currently inaccessible |
When the gateway proxy proxy sends a request error, there should be a retry mechanism. The same is true for forwarding including load balancing.
In this way, error 502 caused by socket hang up and connect ECONNREFUSED can be avoided.
maxAutoRetries can be configured in gateway.config.yml. The default is 1.
such as: