Skip to content

Commit

Permalink
fix poller interval and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhukaihan committed Jul 30, 2024
1 parent 1690d80 commit d5e4cd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/node/src/local/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class LocalEvaluationClient {
this.cohortUpdater = new CohortPoller(
cohortFetcher,
this.cohortStorage,
60000, // this.config.cohortConfig?.cohortPollingIntervalMillis,
60000,
this.config.debug,
);
}
Expand Down
13 changes: 5 additions & 8 deletions packages/node/src/local/cohort/poller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CohortStorage } from 'src/types/cohort';

import { CohortStorage } from '../../types/cohort';
import { ConsoleLogger } from '../../util/logger';
import { Logger } from '../../util/logger';

Expand All @@ -18,7 +17,7 @@ export class CohortPoller implements CohortUpdater {
constructor(
fetcher: CohortFetcher,
storage: CohortStorage,
pollingIntervalMillis = 60,
pollingIntervalMillis = 60000,
debug = false,
) {
this.fetcher = fetcher;
Expand All @@ -28,9 +27,7 @@ export class CohortPoller implements CohortUpdater {
}

/**
* You must call this function to begin polling for flag config updates.
* The promise returned by this function is resolved when the initial call
* to fetch the flag configuration completes.
* You must call this function to begin polling for cohort updates.
*
* Calling this function while the poller is already running does nothing.
*/
Expand All @@ -43,14 +40,14 @@ export class CohortPoller implements CohortUpdater {
try {
await this.update(onChange);
} catch (e) {
this.logger.debug('[Experiment] flag config update failed', e);
this.logger.debug('[Experiment] cohort update failed', e);
}
}, this.pollingIntervalMillis);
}
}

/**
* Stop polling for flag configurations.
* Stop polling for cohorts.
*
* Calling this function while the poller is not running will do nothing.
*/
Expand Down

0 comments on commit d5e4cd7

Please sign in to comment.