mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46: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 deletionCount = 0;
|
||||||
let deletionCountNonExisting = 0;
|
let deletionCountNonExisting = 0;
|
||||||
let notDeletedDueToLocalContent = 0;
|
let notDeletedDueToLocalContent = 0;
|
||||||
|
const notDeletedUids = [];
|
||||||
await batch.processArray(uids, async (uids) => {
|
await batch.processArray(uids, async (uids) => {
|
||||||
const exists = await db.exists(uids.map(uid => `userRemote:${uid}`));
|
const exists = await db.exists(uids.map(uid => `userRemote:${uid}`));
|
||||||
|
|
||||||
@@ -339,11 +340,16 @@ Actors.prune = async () => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
notDeletedDueToLocalContent += 1;
|
notDeletedDueToLocalContent += 1;
|
||||||
|
notDeletedUids.push(uid);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
deletionCountNonExisting += uidsThatDontExist.length;
|
deletionCountNonExisting += uidsThatDontExist.length;
|
||||||
await db.sortedSetRemove('usersRemote:lastCrawled', uidsThatDontExist);
|
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,
|
batch: 50,
|
||||||
interval: 1000,
|
interval: 1000,
|
||||||
|
|||||||
Reference in New Issue
Block a user