From 0b8fa2665cc7f7fd4ca1b5a5694e1d6e4ee5dbcc Mon Sep 17 00:00:00 2001 From: Johann150 Date: Tue, 11 Oct 2022 20:15:59 +0200 Subject: [PATCH] use DISTINCT instead of GROUP BY This should have better performance for large recordsets. Ref: https://akkoma.dev/FoundKeyGang/FoundKey/pulls/198#issuecomment-4032 --- packages/backend/src/remote/activitypub/deliver-manager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/remote/activitypub/deliver-manager.ts b/packages/backend/src/remote/activitypub/deliver-manager.ts index 5fd0d5f60..1f5702ae7 100644 --- a/packages/backend/src/remote/activitypub/deliver-manager.ts +++ b/packages/backend/src/remote/activitypub/deliver-manager.ts @@ -103,12 +103,12 @@ export default class DeliverManager { // deliver to all of known network const sharedInboxes = await Users.createQueryBuilder('users') .select('users.sharedInbox', 'sharedInbox') + // so we don't have to make our inboxes Set work as hard + .distinct(true) // can't deliver to unknown shared inbox .where('users.sharedInbox IS NOT NULL') // don't deliver to ourselves .andWhere('users.host IS NOT NULL') - // so we don't have to make our inboxes Set work as hard - .groupBy('users.sharedInbox') .getRawMany(); for (const inbox of sharedInboxes) {