use DISTINCT instead of GROUP BY

This should have better performance for large recordsets.

Ref: FoundKeyGang/FoundKey#198 (comment)
This commit is contained in:
Johann150 2022-10-11 20:15:59 +02:00
parent 421b42d07d
commit 0b8fa2665c
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -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) {