- Notifications
You must be signed in to change notification settings - Fork4
Load balance support#135
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
src/ConfigurationClientWrapper.ts Outdated
| client:AppConfigurationClient; | ||
| backoffEndTime:number=0;// Timestamp | ||
| #failedAttempts:number=0; | ||
| failedAttempts:number=0; |
zhiyuanliang-msNov 22, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
If you have to expose failedAttempt to be public for testing, you should make this private and create another public property which only has getter. And the getter will return the private #failedAttempt. This can make sure failedAttempt won't be modified outside of the class. And add comment to explain the purpose.
src/ConfigurationClientWrapper.ts Outdated
| if(this.failedAttempts>0){ | ||
| this.failedAttempts=0; | ||
| } | ||
| this.failedAttempts-=1; |
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.
failedAttempts can be negative. This doesn't make sense. If this behavior is only for testing, don't do that.
test/loadBalance.test.ts Outdated
| } | ||
| }); | ||
| // one request for key values, one request for feature flags | ||
| expect(fakeClientWrapper_1.failedAttempts).eq(-1); |
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.
Check thispattern. You can follow this pattern to verify how many times something is called. You can do whatever you want when you stub the fakeClientWrapper. You can set a local counter and when the client is called, counter += 1
2315e4c intopreviewUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
A load balancing mode has been introduced, enabling your application to distribute requests to App Configuration across all available replicas.
Usage: