1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-10 04:32:35 +01:00

Fix OOM on large guild join

This commit is contained in:
Madeline 2023-08-12 18:18:47 +10:00
parent 8764930d9a
commit fd829fc669
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47

View File

@ -16,8 +16,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { PublicUser, User } from "./User";
import { Message } from "./Message";
import { HTTPError } from "lambert-server";
import {
BeforeInsert,
BeforeUpdate,
@ -32,8 +31,8 @@ import {
PrimaryGeneratedColumn,
RelationId,
} from "typeorm";
import { Guild } from "./Guild";
import { Config, emitEvent } from "../util";
import { Ban, PublicGuildRelations } from ".";
import { ReadyGuildDTO } from "../dtos";
import {
GuildCreateEvent,
GuildDeleteEvent,
@ -42,12 +41,13 @@ import {
GuildMemberUpdateEvent,
MessageCreateEvent,
} from "../interfaces";
import { HTTPError } from "lambert-server";
import { Role } from "./Role";
import { BaseClassWithoutId } from "./BaseClass";
import { Ban, PublicGuildRelations } from ".";
import { Config, emitEvent } from "../util";
import { DiscordApiErrors } from "../util/Constants";
import { ReadyGuildDTO } from "../dtos";
import { BaseClassWithoutId } from "./BaseClass";
import { Guild } from "./Guild";
import { Message } from "./Message";
import { Role } from "./Role";
import { PublicUser, User } from "./User";
export const MemberPrivateProjection: (keyof Member)[] = [
"id",
@ -326,7 +326,7 @@ export class Member extends BaseClassWithoutId {
where: {
id: guild_id,
},
relations: [...PublicGuildRelations, "system_channel"],
relations: PublicGuildRelations,
});
const memberCount = await Member.count({ where: { guild_id } });