mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: makeCacheableSignalKeyStore logger optional (#1332)
This commit is contained in:
@@ -14,7 +14,7 @@ import { ILogger } from './logger'
|
|||||||
*/
|
*/
|
||||||
export function makeCacheableSignalKeyStore(
|
export function makeCacheableSignalKeyStore(
|
||||||
store: SignalKeyStore,
|
store: SignalKeyStore,
|
||||||
logger: ILogger,
|
logger?: ILogger,
|
||||||
_cache?: CacheStore
|
_cache?: CacheStore
|
||||||
): SignalKeyStore {
|
): SignalKeyStore {
|
||||||
const cache = _cache || new NodeCache({
|
const cache = _cache || new NodeCache({
|
||||||
@@ -41,7 +41,7 @@ export function makeCacheableSignalKeyStore(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(idsToFetch.length) {
|
if(idsToFetch.length) {
|
||||||
logger.trace({ items: idsToFetch.length }, 'loading from store')
|
logger?.trace({ items: idsToFetch.length }, 'loading from store')
|
||||||
const fetched = await store.get(type, idsToFetch)
|
const fetched = await store.get(type, idsToFetch)
|
||||||
for(const id of idsToFetch) {
|
for(const id of idsToFetch) {
|
||||||
const item = fetched[id]
|
const item = fetched[id]
|
||||||
@@ -63,7 +63,7 @@ export function makeCacheableSignalKeyStore(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace({ keys }, 'updated cache')
|
logger?.trace({ keys }, 'updated cache')
|
||||||
|
|
||||||
await store.set(data)
|
await store.set(data)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user