|
|
@ -32,7 +32,9 @@ function setup(service, should_execute) { |
|
|
|
return next(); |
|
|
|
return next(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const start = Date.now(); |
|
|
|
service(req, res, (err, translations) => { |
|
|
|
service(req, res, (err, translations) => { |
|
|
|
|
|
|
|
const requestTime = Date.now() - start; |
|
|
|
// if there's an error, log it and bail
|
|
|
|
// if there's an error, log it and bail
|
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
logger.info(`[middleware:language][error]`); |
|
|
|
logger.info(`[middleware:language][error]`); |
|
|
@ -40,6 +42,12 @@ function setup(service, should_execute) { |
|
|
|
return next(); |
|
|
|
return next(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info({ |
|
|
|
|
|
|
|
time: requestTime, |
|
|
|
|
|
|
|
language: req.clean.lang.iso6391, |
|
|
|
|
|
|
|
service: 'language', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// otherwise, update all the docs with translations
|
|
|
|
// otherwise, update all the docs with translations
|
|
|
|
updateDocs(req, res, _.defaultTo(translations, [])); |
|
|
|
updateDocs(req, res, _.defaultTo(translations, [])); |
|
|
|
next(); |
|
|
|
next(); |
|
|
|