Skip to content

Commit

Permalink
Prepare v8.1.0 release (#90)
Browse files Browse the repository at this point in the history
* Improve config refresh performance

* Remove unnecessary disposed check (hook subscribers are disconnected on disposal anyway)

* Fix dependency vulnerabilities

* Bump version
  • Loading branch information
adams85 authored Jul 26, 2023
1 parent aa9a614 commit e2cec20
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 39 deletions.
64 changes: 32 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "configcat-common",
"version": "8.0.2",
"version": "8.1.0",
"description": "ConfigCat is a configuration as a service that lets you manage your features and configurations without actually deploying new code.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
6 changes: 1 addition & 5 deletions src/AutoPollConfigService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ export class AutoPollConfigService extends ConfigServiceBase<AutoPollOptions> im
resolve();
});

this.initialization.then(() => {
if (!this.disposed) {
options.hooks.emit("clientReady", this.getReadyState(options.cache.getInMemory()));
}
});
this.initialization.then(() => options.hooks.emit("clientReady", this.getReadyState(options.cache.getInMemory())));

if (options.maxInitWaitTimeSeconds > 0) {
setTimeout(() => this.signalInitialization(), options.maxInitWaitTimeSeconds * 1000);
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigServiceBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export abstract class ConfigServiceBase<TOptions extends OptionsBase> {

this.onConfigUpdated(fetchResult.config);

if (success && (fetchResult.config.httpETag != latestConfig.httpETag || fetchResult.config.configJson != latestConfig.configJson)) {
if (success && !ProjectConfig.equals(fetchResult.config, latestConfig)) {
this.onConfigChanged(fetchResult.config);
}

Expand Down
7 changes: 7 additions & 0 deletions src/ProjectConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ export class ProjectConfig {

static readonly empty = new ProjectConfig(void 0, void 0, 0, void 0);

static equals(projectConfig1: ProjectConfig, projectConfig2: ProjectConfig): boolean {
// When both ETags are available, we don't need to check the JSON content.
return projectConfig1.httpETag && projectConfig2.httpETag
? projectConfig1.httpETag === projectConfig2.httpETag
: projectConfig1.configJson === projectConfig2.configJson;
}

constructor(
readonly configJson: string | undefined,
readonly config: Config | undefined,
Expand Down

0 comments on commit e2cec20

Please sign in to comment.