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