diff --git a/src/framework/services/DatabaseService.ts b/src/framework/services/DatabaseService.ts index 22bab6c5..c219d14d 100644 --- a/src/framework/services/DatabaseService.ts +++ b/src/framework/services/DatabaseService.ts @@ -126,7 +126,7 @@ export class DatabaseService { const [rows] = await pool.query(`SELECT ${table}.* FROM ${db}.${table} WHERE ${where}`, values); return rows as T[]; } - private async findManyOnAllShards( + private async findManyOnSpecificShards( table: TABLE, where: string, values: O[], @@ -223,7 +223,7 @@ export class DatabaseService { return this.findOne(id, TABLE.guilds, '`id` = ?', [id]); } public async getBannedGuilds(ids: string[]) { - return await this.findManyOnAllShards(TABLE.guilds, '`id` IN (?) AND `banReason` IS NOT NULL', ids); + return await this.findManyOnSpecificShards(TABLE.guilds, '`id` IN (?) AND `banReason` IS NOT NULL', ids); } public async saveGuilds(guilds: Partial[]) { await this.insertOrUpdate( @@ -356,7 +356,7 @@ export class DatabaseService { // InviteCode // -------------- public async getAllInviteCodesForGuilds(guildIds: string[]) { - return this.findManyOnAllShards(TABLE.inviteCodes, '`guildId` IN(?)', guildIds); + return this.findManyOnSpecificShards(TABLE.inviteCodes, '`guildId` IN(?)', guildIds); } public async getInviteCodesForGuild(guildId: string) { const [db, pool] = this.getDbInfo(guildId); @@ -832,7 +832,7 @@ export class DatabaseService { ]); } public async getScheduledActionsForGuilds(guildIds: string[]) { - return this.findManyOnAllShards(TABLE.scheduledActions, '`guildId` IN (?)', guildIds); + return this.findManyOnSpecificShards(TABLE.scheduledActions, '`guildId` IN (?)', guildIds); } public async saveScheduledAction(action: Partial) { const res = await this.insertOrUpdate( @@ -896,7 +896,7 @@ export class DatabaseService { `SELECT psg.* FROM ${db}.${TABLE.premiumSubscriptionGuilds} psg WHERE psg.\`memberId\` = ?`, [memberId] ); - const guilds = await this.findManyOnAllShards( + const guilds = await this.findManyOnSpecificShards( TABLE.guilds, `id IN(?)`, rows.map(r => r.guildId)