same shit for overboard

merge-requests/208/head
Thomas Lynch 4 years ago
parent a15b36c5b0
commit 248b41081c
  1. 17
      models/pages/overboard.js

@ -6,13 +6,16 @@ const { Posts, Boards } = require(__dirname+'/../../db/')
module.exports = async (req, res, next) => {
let threads = [];
try {
const listedBoards = await Boards.getLocalListed();
threads = await Posts.getRecent(listedBoards, 1, overboardLimit, false, false);
} catch (err) {
return next(err);
}
let threads = (await cache.get('overboard')) || [];
if (!threads || threads.length === 0) {
try {
const listedBoards = await Boards.getLocalListed();
threads = await Posts.getRecent(listedBoards, 1, overboardLimit, false, false);
cache.set('overboard', threads, 60);
} catch (err) {
return next(err);
}
}
res
.set('Cache-Control', 'public, max-age=60')

Loading…
Cancel
Save