mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-03 11:01:20 +01:00
refactor: get rid of cache for tid posters, was never cleared
This commit is contained in:
@@ -8,7 +8,6 @@ const request = require('../request');
|
||||
const db = require('../database');
|
||||
const meta = require('../meta');
|
||||
const categories = require('../categories');
|
||||
const topics = require('../topics');
|
||||
const posts = require('../posts');
|
||||
const messaging = require('../messaging');
|
||||
const user = require('../user');
|
||||
@@ -521,7 +520,7 @@ ActivityPub.buildRecipients = async function (object, options) {
|
||||
// Topic posters, post announcers and their followers
|
||||
if (pid) {
|
||||
const tid = await posts.getPostField(pid, 'tid');
|
||||
const participants = (await topics.getUids(tid))
|
||||
const participants = (await db.getSortedSetMembers(`tid:${tid}:posters`))
|
||||
.filter(uid => !utils.isNumber(uid)); // remote users only
|
||||
const announcers = (await ActivityPub.notes.announce.list({ pid })).map(({ actor }) => actor);
|
||||
const auxiliaries = Array.from(new Set([...participants, ...announcers]));
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
const db = require('../database');
|
||||
const utils = require('../utils');
|
||||
const cache = require('../cache');
|
||||
|
||||
module.exports = function (Topics) {
|
||||
Topics.isOwner = async function (tid, uid) {
|
||||
@@ -14,13 +13,6 @@ module.exports = function (Topics) {
|
||||
};
|
||||
|
||||
Topics.getUids = async function (tid) {
|
||||
const cacheKey = `tid:${tid}:uids`;
|
||||
let posters = cache.get(cacheKey, tid);
|
||||
if (!posters) {
|
||||
posters = await db.getSortedSetRevRangeByScore(`tid:${tid}:posters`, 0, -1, '+inf', 1);
|
||||
cache.set(cacheKey, posters);
|
||||
}
|
||||
|
||||
return posters;
|
||||
return await db.getSortedSetRevRangeByScore(`tid:${tid}:posters`, 0, -1, '+inf', 1);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user