Skip to content
Snippets Groups Projects
Commit 70e26864 authored by richard.petersen's avatar richard.petersen :sailboat:
Browse files

fixed: file logging does not contain the requested file version

parent edaf93ec
No related branches found
No related tags found
No related merge requests found
......@@ -62,7 +62,7 @@ export function getFile ({ version, path }) {
// try to get the file synchronously.
const data = cache.getCache()[key]
if (data) {
logger.debug(`[Files] Resolve from memory: ${path}`)
logger.debug(`[Files] Resolve from memory: ${key}`)
return data
}
......@@ -78,21 +78,21 @@ export function getFile ({ version, path }) {
])
if (body) {
logger.debug(`[Files] Resolve from redis: ${path}`)
logger.debug(`[Files] Resolve from redis: ${key}`)
return (cache.getCache()[key] = { body, ...JSON.parse(meta) })
}
}
const dataFromServer = await fetchFileWithHeaders({ version, path })
if (redis.isEnabled()) {
logger.debug(`[Files] Store in redis: ${path}`)
logger.debug(`[Files] Store in redis: ${key}`)
const { body, ...rest } = dataFromServer
redis.client.set(bodyKey, createWritable(body))
redis.client.set(metaKey, JSON.stringify(rest))
}
// overwrite cache with synchronous data
logger.debug(`[Files] Store in memory: ${path}`)
logger.debug(`[Files] Store in memory: ${key}`)
return (cache.getCache()[key] = dataFromServer)
})()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment