cached fetcher debug env var
This commit is contained in:
parent
7eaaa7ce44
commit
c634c61dd2
|
@ -21,4 +21,5 @@ PRISMA_SLOW_LOGS_MS=50
|
|||
GRAPHQL_SLOW_LOGS_MS=50
|
||||
DB_APP_CONNECTION_LIMIT=4
|
||||
DB_WORKER_CONNECTION_LIMIT=2
|
||||
DB_TRANSACTION_TIMEOUT=10000
|
||||
DB_TRANSACTION_TIMEOUT=10000
|
||||
DEBUG_CACHED_FETCHER=1
|
||||
|
|
|
@ -98,7 +98,10 @@ function createDebugLogger (name, cache, debug) {
|
|||
}
|
||||
}
|
||||
|
||||
export function cachedFetcher (fetcher, { maxSize = 100, cacheExpiry, forceRefreshThreshold, keyGenerator, debug = false }) {
|
||||
export function cachedFetcher (fetcher, {
|
||||
maxSize = 100, cacheExpiry, forceRefreshThreshold,
|
||||
keyGenerator, debug = process.env.DEBUG_CACHED_FETCHER
|
||||
}) {
|
||||
const cache = new LRUCache(maxSize)
|
||||
const name = fetcher.name || fetcher.toString().slice(0, 20).replace(/\s+/g, '_')
|
||||
const logger = createDebugLogger(name, cache, debug)
|
||||
|
|
Loading…
Reference in New Issue