From 0d19dc7b48134c70d937becc757efff69ae9535a Mon Sep 17 00:00:00 2001 From: Sven Sauleau Date: Mon, 20 Feb 2023 15:27:45 +0000 Subject: [PATCH] fix move followers/following --- backend/src/activitypub/activities/handle.ts | 17 ++++------------- backend/src/mastodon/follow.ts | 1 - 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/backend/src/activitypub/activities/handle.ts b/backend/src/activitypub/activities/handle.ts index 6bbdc6c..2bcd807 100644 --- a/backend/src/activitypub/activities/handle.ts +++ b/backend/src/activitypub/activities/handle.ts @@ -394,13 +394,8 @@ export async function handle( // TODO: eventually move to queue and move workers while (collection.items.length > 0) { const batch = collection.items.splice(0, 20) - await Promise.all( - batch.map(async (items) => { - console.log({ items }) - await moveFollowers(db, localActor, items) - console.log(`moved ${items.length} followers`) - }) - ) + await moveFollowers(db, localActor, batch) + console.log(`moved ${batch.length} followers`) } } @@ -412,12 +407,8 @@ export async function handle( // TODO: eventually move to queue and move workers while (collection.items.length > 0) { const batch = collection.items.splice(0, 20) - await Promise.all( - batch.map(async (items) => { - await moveFollowing(db, localActor, items) - console.log(`moved ${items.length} following`) - }) - ) + await moveFollowing(db, localActor, batch) + console.log(`moved ${batch.length} following`) } } diff --git a/backend/src/mastodon/follow.ts b/backend/src/mastodon/follow.ts index 8a54b8c..16ef42e 100644 --- a/backend/src/mastodon/follow.ts +++ b/backend/src/mastodon/follow.ts @@ -19,7 +19,6 @@ export async function moveFollowers(db: D1Database, actor: Actor, followers: Arr const actorAcc = urlToHandle(actor.id) for (let i = 0; i < followers.length; i++) { - console.log(followers[i]) const follower = new URL(followers[i]) const followActor = await actors.getAndCache(follower, db)