Node.js based forum software built for the modern web
refactor: get rid of cache for tid posters, was never cleared
Barış Soner Uşaklı065abbf249e0
diff --git a/src/activitypub/index.js b/src/activitypub/index.jsindex 4670d94546..4a5bec8f4c 100644--- a/src/activitypub/index.js+++ b/src/activitypub/index.js@@ -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 followersif (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 onlyconst announcers = (await ActivityPub.notes.announce.list({ pid })).map(({ actor }) => actor);const auxiliaries = Array.from(new Set([...participants, ...announcers]));diff --git a/src/topics/user.js b/src/topics/user.jsindex f7d13f50ea..7a2265512c 100644--- a/src/topics/user.js+++ b/src/topics/user.js@@ -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);};};