Skip to content

Commit

Permalink
statsig-io#16 getConfigSpecs put behind more caching to prevent read …
Browse files Browse the repository at this point in the history
…load on main storage
  • Loading branch information
Dave Wheeler committed Dec 16, 2024
1 parent 7b68693 commit 200f931
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/StatsigOnPrem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ export default class StatsigOnPrem implements StatsigInterface {
sdkKey: string,
options?: ConfigSpecsOptions
): Promise<ConfigSpecs> {
const registeredKeys = await this.store.getRegisteredSDKKeys();
if (!registeredKeys.has(sdkKey)) {
console.warn("Attempting to use a non-registered key");
}

const cachedSpecs = await this.cache.getSpecs(sdkKey, options);
if (cachedSpecs) {
return cachedSpecs;
}

const registeredKeys = await this.getRegisteredSDKKeys();
if (!registeredKeys.has(sdkKey)) {
console.warn("Attempting to use a non-registered key");
}

const targetApps = await this.store.getTargetAppsFromSDKKey(sdkKey);
const entities = await this.store.getEntityAssocsForMultipleTargetApps(
targetApps
Expand Down

0 comments on commit 200f931

Please sign in to comment.