Skip to content

Commit

Permalink
fix: catch and log error from flag config poller request (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgiori authored Oct 4, 2022
1 parent 0518c3a commit 6e6b051
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/node/src/local/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export class FlagConfigFetcher {
const endpoint = `${this.serverUrl}/sdk/rules?eval_mode=local`;
const headers = {
Authorization: `Api-Key ${this.apiKey}`,
Accept: 'application/json',
'X-Amp-Exp-Library': `experiment-node-server/${PACKAGE_VERSION}`,
'Content-Type': 'application/json;charset=utf-8',
};
const body = null;
this.logger.debug('[Experiment] Get flag configs');
Expand Down
6 changes: 5 additions & 1 deletion packages/node/src/local/poller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ export class FlagConfigPoller {
if (!this.poller) {
this.logger.debug('[Experiment] poller - start');
this.poller = setInterval(async () => {
await this.update(onChange);
try {
await this.update(onChange);
} catch (e) {
this.logger.debug('[Experiment] flag config update failed', e);
}
}, this.pollingIntervalMillis);

// Fetch initial flag configs and await the result.
Expand Down

0 comments on commit 6e6b051

Please sign in to comment.