Skip to content

Commit

Permalink
Merge pull request #281 from bcgsc/bugfix/DEVSU-2140-disable-cache-sm…
Browse files Browse the repository at this point in the history
…allmut

bugfix/DEVSU-2140-disable-cache-smallmut
  • Loading branch information
Nithriel authored Nov 22, 2023
2 parents 7a4f3c0 + 0306bdd commit 726f053
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions app/routes/report/smallMutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const router = express.Router({mergeParams: true});

const db = require('../../models');
const logger = require('../../log');
const cache = require('../../cache');

// Middleware for small mutations
router.param('mutation', async (req, res, next, mutIdent) => {
Expand Down Expand Up @@ -71,18 +70,6 @@ router.route('/:mutation([A-z0-9-]{36})')
router.route('/')
.get(async (req, res) => {
// Get all small mutations for this report
const key = `/reports/${req.report.ident}/small-mutations`;

try {
const cacheResults = await cache.get(key);

if (cacheResults) {
res.type('json');
return res.send(cacheResults);
}
} catch (error) {
logger.error(`Error while checking cache for small mutations ${error}`);
}

try {
const results = await db.models.smallMutations.scope('extended').findAll({
Expand All @@ -98,10 +85,6 @@ router.route('/')
],
});

if (key) {
cache.set(key, JSON.stringify(results), 'EX', 14400);
}

return res.json(results);
} catch (error) {
logger.error(`Unable to retrieve small mutations ${error}`);
Expand Down

0 comments on commit 726f053

Please sign in to comment.