mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: actor.prune, dont try deleting same users
over and over if they have local content
This commit is contained in:
@@ -314,6 +314,7 @@ Actors.prune = async () => {
|
||||
let deletionCount = 0;
|
||||
let deletionCountNonExisting = 0;
|
||||
let notDeletedDueToLocalContent = 0;
|
||||
const notDeletedUids = [];
|
||||
await batch.processArray(uids, async (uids) => {
|
||||
const exists = await db.exists(uids.map(uid => `userRemote:${uid}`));
|
||||
|
||||
@@ -339,11 +340,16 @@ Actors.prune = async () => {
|
||||
}
|
||||
} else {
|
||||
notDeletedDueToLocalContent += 1;
|
||||
notDeletedUids.push(uid);
|
||||
}
|
||||
}));
|
||||
|
||||
deletionCountNonExisting += uidsThatDontExist.length;
|
||||
await db.sortedSetRemove('usersRemote:lastCrawled', uidsThatDontExist);
|
||||
// update timestamp in usersRemote:lastCrawled so we don't try to delete users
|
||||
// with content over and over
|
||||
const now = Date.now();
|
||||
await db.sortedSetAdd('usersRemote:lastCrawled', notDeletedUids.map(() => now), notDeletedUids);
|
||||
}, {
|
||||
batch: 50,
|
||||
interval: 1000,
|
||||
|
||||
Reference in New Issue
Block a user