mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #9410, fix post queue
items in the cache were parsed over and over again
This commit is contained in:
@@ -20,10 +20,9 @@ const socketHelpers = require('../socket.io/helpers');
|
|||||||
module.exports = function (Posts) {
|
module.exports = function (Posts) {
|
||||||
Posts.getQueuedPosts = async (filter = {}, options = {}) => {
|
Posts.getQueuedPosts = async (filter = {}, options = {}) => {
|
||||||
options = { metadata: true, ...options }; // defaults
|
options = { metadata: true, ...options }; // defaults
|
||||||
let postData;
|
let postData = _.cloneDeep(cache.get('post-queue'));
|
||||||
if (cache.has('post-queue')) {
|
console.log('gg', postData);
|
||||||
postData = cache.get('post-queue');
|
if (!postData) {
|
||||||
} else {
|
|
||||||
const ids = await db.getSortedSetRange('post:queue', 0, -1);
|
const ids = await db.getSortedSetRange('post:queue', 0, -1);
|
||||||
const keys = ids.map(id => `post:queue:${id}`);
|
const keys = ids.map(id => `post:queue:${id}`);
|
||||||
postData = await db.getObjects(keys);
|
postData = await db.getObjects(keys);
|
||||||
@@ -42,7 +41,7 @@ module.exports = function (Posts) {
|
|||||||
postData.data.title = validator.escape(String(postData.data.title || ''));
|
postData.data.title = validator.escape(String(postData.data.title || ''));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cache.set('post-queue', postData);
|
cache.set('post-queue', _.cloneDeep(postData));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.metadata) {
|
if (options.metadata) {
|
||||||
|
|||||||
Reference in New Issue
Block a user