fix: maybe last tweak

This commit is contained in:
Julian Lam
2024-04-04 13:02:16 -04:00
parent ae146024af
commit 42bdffdc94

View File

@@ -13,10 +13,15 @@ module.exports = {
const { progress } = this; const { progress } = this;
const interval = 1500; const interval = 1500;
await batch.processSortedSet('usersRemote:lastCrawled', async (ids) => { let actorIds = await db.getSortedSetMembers('usersRemote:lastCrawled');
const exists = await Promise.all(ids.map(async id => await db.isObjectField(`userRemote:${id}`, 'url'))); progress.total = actorIds.length;
ids = ids.filter((id, idx) => exists[idx]); const exists = await Promise.all(actorIds.map(async id => await db.isObjectField(`userRemote:${id}`, 'url')));
actorIds = actorIds.filter((id, idx) => exists[idx]);
// Increment ones that were already completed
progress.incr(progress.total - actorIds.length);
await batch.processArray(actorIds, async (ids) => {
try { try {
await activitypub.actors.assert(ids, { update: true }); await activitypub.actors.assert(ids, { update: true });
} catch (e) { } catch (e) {