-
Notifications
You must be signed in to change notification settings - Fork 46
feat: support a few domains (500) #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support a few domains (500) #283
Conversation
ed612be
to
66b0652
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have failed tests :(
Pls write E2E tests for this |
8fcaf18
to
b2ce5be
Compare
fixed |
done |
@@ -6,13 +6,14 @@ errors.WrapWithCacheError = extendError('WrapWithCacheError'); | |||
const wrapWithCache = (localStorage, logger, createHash = hashFn) => (fn, cacheParams = {}) => { | |||
const { | |||
cacheForSeconds = 60, | |||
name = '', // "hash" of returned value is based only on arguments, so with the help "name" we can add prefix to hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a required parameter.
} = cacheParams; | ||
|
||
const cacheResolutionPromise = {}; | ||
|
||
return (...args) => { | ||
const now = Math.floor(Date.now() / 1000); | ||
const hash = args.length > 0 ? createHash(JSON.stringify(args)) : '__null__'; | ||
const hash = `${name ? name + '__' : ''}${args.length > 0 ? createHash(JSON.stringify(args)) : '__null__'}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass name to hash function. Don't do a concatenation after
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now we would use hash fn even if we don't have args
No description provided.