From ffbe4b7bb727963f6191607e7a984c842b33848a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 11 Feb 2025 14:32:54 -0500 Subject: [PATCH] fix: actor.prune, dont try deleting same users over and over if they have local content --- src/activitypub/actors.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/activitypub/actors.js b/src/activitypub/actors.js index ccd5a9fb41..bda513661c 100644 --- a/src/activitypub/actors.js +++ b/src/activitypub/actors.js @@ -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,