mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
fix: guard against infinite loop during topic purge batch call
This commit is contained in:
@@ -64,6 +64,7 @@ module.exports = function (Topics) {
|
|||||||
const mainPid = await Topics.getTopicField(tid, 'mainPid');
|
const mainPid = await Topics.getTopicField(tid, 'mainPid');
|
||||||
await batch.processSortedSet(`tid:${tid}:posts`, async (pids) => {
|
await batch.processSortedSet(`tid:${tid}:posts`, async (pids) => {
|
||||||
await posts.purge(pids, uid);
|
await posts.purge(pids, uid);
|
||||||
|
await db.sortedSetRemove(`tid:${tid}:posts`, pids); // Guard against infinite loop if pid already does not exist in db
|
||||||
}, { alwaysStartAt: 0, batch: 500 });
|
}, { alwaysStartAt: 0, batch: 500 });
|
||||||
await posts.purge(mainPid, uid);
|
await posts.purge(mainPid, uid);
|
||||||
await Topics.purge(tid, uid);
|
await Topics.purge(tid, uid);
|
||||||
|
|||||||
Reference in New Issue
Block a user