Skip to content

Commit 3d3578b

Browse files
Polishing
1 parent 6b5eaca commit 3d3578b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/storages/inLocalStorage/validateCache.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ function validateExpiration(options: SplitIO.InLocalStorageOptions, settings: IS
6868
* @returns `true` if cache is ready to be used, `false` otherwise (cache was cleared or there is no cache)
6969
*/
7070
export function validateCache(options: SplitIO.InLocalStorageOptions, settings: ISettings, keys: KeyBuilderCS, splits: SplitsCacheInLocal, rbSegments: RBSegmentsCacheInLocal, segments: MySegmentsCacheInLocal, largeSegments: MySegmentsCacheInLocal): Promise<boolean> {
71-
return new Promise<boolean>((resolve) => {
71+
72+
return Promise.resolve().then(() => {
7273
const currentTimestamp = Date.now();
7374
const isThereCache = splits.getChangeNumber() > -1;
7475

@@ -85,10 +86,10 @@ export function validateCache(options: SplitIO.InLocalStorageOptions, settings:
8586
settings.log.error(LOG_PREFIX + e);
8687
}
8788

88-
resolve(false);
89+
return false;
8990
}
9091

9192
// Check if ready from cache
92-
resolve(isThereCache);
93+
return isThereCache;
9394
});
9495
}

0 commit comments

Comments
 (0)