Skip to content

Commit

Permalink
Merge pull request #25 from configcat/fix-infinite-callback-loop
Browse files Browse the repository at this point in the history
Fix infinite callback loop when autpoll fetch fails with empty cache
  • Loading branch information
z4kn4fein authored Mar 11, 2021
2 parents e7b08a9 + 670795b commit be7bd67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

1. Run `./deploy.sh`

2. Update `common-js` in `js-sdk` and `node-sdk` and re-deploy both packages.
2. Update `common-js` in `js-sdk` and `node-sdk` and `js-ssr-sdk` and re-deploy both packages.

or

Expand Down
6 changes: 4 additions & 2 deletions src/AutoPollConfigService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ export class AutoPollConfigService extends ConfigServiceBase implements IConfigS

const newConfig = await this.refreshLogicBaseAsync(cachedConfig, forceUpdateCache)

if (!cachedConfig || !ProjectConfig.equals(cachedConfig, newConfig)) {

let weDontHaveCachedYetButHaveNew = !cachedConfig && newConfig;
let weHaveBothButTheyDiffers = cachedConfig && newConfig && !ProjectConfig.equals(cachedConfig, newConfig);

if (weDontHaveCachedYetButHaveNew || weHaveBothButTheyDiffers) {
this.configChanged();
}

Expand Down

0 comments on commit be7bd67

Please sign in to comment.