-
Notifications
You must be signed in to change notification settings - Fork 1
feat: ImmuatableConfiguration #231
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: main
Are you sure you want to change the base?
Changes from 32 commits
f45b39c
704d2e5
0e9c2f5
8b11bb4
84857ad
688b200
40a953d
3786b78
2ab3dda
06fc3e5
1cc8cea
f7e539e
39aed59
421470d
5b34fc7
15e3262
bf412f8
1ff4f35
5fc7ef3
3ab4301
3533fa5
b4b44b9
4a1231b
0f1874e
3f86324
94e7f3e
8796c23
19ba44d
b08e9f5
c284c36
bb75ce3
25d9c25
0f883d8
f6bd4de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import { BanditVariation, BanditParameters, Flag, BanditReference } from './inte | |
export default class ConfigurationRequestor { | ||
private banditModelVersions: string[] = []; | ||
private readonly configuration: StoreBackedConfiguration; | ||
private configurationCopy: IConfiguration; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. save and return the copy only |
||
|
||
constructor( | ||
private readonly httpClient: IHttpClient, | ||
|
@@ -25,14 +26,15 @@ export default class ConfigurationRequestor { | |
this.banditVariationConfigurationStore, | ||
this.banditModelConfigurationStore, | ||
); | ||
this.configurationCopy = this.configuration.copy(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be large; I wonder if we do the copying just in time when |
||
} | ||
|
||
public isFlagConfigExpired(): Promise<boolean> { | ||
return this.flagConfigurationStore.isExpired(); | ||
} | ||
|
||
public getConfiguration(): IConfiguration { | ||
return this.configuration; | ||
return this.configurationCopy; | ||
} | ||
|
||
async fetchAndStoreConfigurations(): Promise<void> { | ||
|
@@ -92,6 +94,7 @@ export default class ConfigurationRequestor { | |
banditModelPacket, | ||
) | ||
) { | ||
this.configurationCopy = this.configuration.copy(); | ||
// TODO: Notify that config updated. | ||
} | ||
} | ||
|
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.
Since config is a snapshot, we take it after the fetch&store