-
Notifications
You must be signed in to change notification settings - Fork 2
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
Load balance support #135
Load balance support #135
Conversation
src/ConfigurationClientWrapper.ts
Outdated
@@ -12,7 +12,7 @@ export class ConfigurationClientWrapper { | |||
endpoint: string; | |||
client: AppConfigurationClient; | |||
backoffEndTime: number = 0; // Timestamp | |||
#failedAttempts: number = 0; | |||
failedAttempts: number = 0; |
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 this pattern. 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
A load balancing mode has been introduced, enabling your application to distribute requests to App Configuration across all available replicas.
Usage: