fix bug where middleware produces a cached app.tasks with an empty array (#947)

This commit is contained in:
Dave Horton
2024-10-24 20:43:27 -04:00
committed by GitHub
parent a005253a9f
commit 8e4995ec02

View File

@@ -385,7 +385,7 @@ module.exports = function(srf, logger) {
const {rootSpan, siprec, application:app} = req.locals;
let span;
try {
if (app.tasks && !JAMBONES_MYSQL_REFRESH_TTL) {
if (app.tasks && app.tasks?.length > 0 && !JAMBONES_MYSQL_REFRESH_TTL) {
app.tasks = normalizeJambones(logger, app.tasks).map((tdata) => makeTask(logger, tdata));
if (0 === app.tasks.length) throw new Error('no application provided');
return next();