mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-24 08:28:27 +03:00
2 things
Consider using "forEach" instead of "map" as its return value is not being used here. Replace this trivial promise with "Promise.resolve".
This commit is contained in:
@@ -23,9 +23,7 @@ export function createMemoryCache(memoryFn: (...args: any[]) => void, cacheTimeM
|
||||
}
|
||||
}
|
||||
// create new promise
|
||||
const promise = new Promise((resolve) => {
|
||||
resolve(memoryFn(...args));
|
||||
});
|
||||
const promise = Promise.resolve(memoryFn(...args));
|
||||
// store promise reference until fulfilled
|
||||
promiseMemory.set(cacheKey, promise);
|
||||
return promise.then(result => {
|
||||
|
||||
Reference in New Issue
Block a user