Skip to content

Commit

Permalink
Remove cache on get report
Browse files Browse the repository at this point in the history
  • Loading branch information
Nithriel committed Nov 15, 2023
1 parent 09efab2 commit 68dc978
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions app/middleware/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,8 @@ module.exports = async (req, res, next, ident) => {
},
];

// Check cache for report
const key = `/reports/${ident}`;
let result;

try {
result = await cache.get(key);
} catch (error) {
logger.error(`Error during report cache get ${error}`);
}

if (result) {
// Build Sequelize model from cached string without calling db
result = db.models.report.build(JSON.parse(result), {
Expand Down Expand Up @@ -68,9 +60,6 @@ module.exports = async (req, res, next, ident) => {
logger.error(`User does not have non-production access to ${ident}`);
return res.status(HTTP_STATUS.FORBIDDEN).json({error: {message: 'User does not have access to Non-Production reports'}});
}

// Add result to cache
cache.set(key, JSON.stringify(result), 'EX', 14400);
}

// Add report to request
Expand Down

0 comments on commit 68dc978

Please sign in to comment.