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) => { module.exports = async (req, res, next) => {
let threads = []; let threads = (await cache.get('overboard')) || [];
try { if (!threads || threads.length === 0) {
const listedBoards = await Boards.getLocalListed(); try {
threads = await Posts.getRecent(listedBoards, 1, overboardLimit, false, false); const listedBoards = await Boards.getLocalListed();
} catch (err) { threads = await Posts.getRecent(listedBoards, 1, overboardLimit, false, false);
return next(err); cache.set('overboard', threads, 60);
} } catch (err) {
return next(err);
}
}
res res
.set('Cache-Control', 'public, max-age=60') .set('Cache-Control', 'public, max-age=60')

Loading…
Cancel
Save