style: auto-fix lint and format
This commit is contained in:
1 parent
8571b4dcb7
commit
230ee3e1fc
2 files changed
+21
-52
No files matched your search
@@ -27,15 +27,18 @@ export const createRequestHandler = <TData, TInput extends Record<string, unknow
|
||||
const existing = inflight.get(key);
|
||||
if (existing) return existing as Promise<CacheEntry<TData>>;
|
||||
|
||||
const promise = options.requestAsync(input).then((data) => {
|
||||
const entry: CacheEntry<TData> = { data, timestamp: new Date(), expiresAt: Date.now() + ttl };
|
||||
cache.set(key, entry as CacheEntry<unknown>);
|
||||
inflight.delete(key);
|
||||
return entry;
|
||||
}).catch((err) => {
|
||||
inflight.delete(key);
|
||||
throw err;
|
||||
});
|
||||
const promise = options
|
||||
.requestAsync(input)
|
||||
.then((data) => {
|
||||
const entry: CacheEntry<TData> = { data, timestamp: new Date(), expiresAt: Date.now() + ttl };
|
||||
cache.set(key, entry as CacheEntry<unknown>);
|
||||
inflight.delete(key);
|
||||
return entry;
|
||||
})
|
||||
.catch((err) => {
|
||||
inflight.delete(key);
|
||||
throw err;
|
||||
});
|
||||
|
||||
inflight.set(key, promise as Promise<CacheEntry<unknown>>);
|
||||
return promise;
|
||||
|
||||
Reference in new issue
Block a user