Fix OOM on large guild join
This commit is contained in:
parent
8764930d9a
commit
fd829fc669
@ -16,8 +16,7 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PublicUser, User } from "./User";
|
import { HTTPError } from "lambert-server";
|
||||||
import { Message } from "./Message";
|
|
||||||
import {
|
import {
|
||||||
BeforeInsert,
|
BeforeInsert,
|
||||||
BeforeUpdate,
|
BeforeUpdate,
|
||||||
@ -32,8 +31,8 @@ import {
|
|||||||
PrimaryGeneratedColumn,
|
PrimaryGeneratedColumn,
|
||||||
RelationId,
|
RelationId,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { Guild } from "./Guild";
|
import { Ban, PublicGuildRelations } from ".";
|
||||||
import { Config, emitEvent } from "../util";
|
import { ReadyGuildDTO } from "../dtos";
|
||||||
import {
|
import {
|
||||||
GuildCreateEvent,
|
GuildCreateEvent,
|
||||||
GuildDeleteEvent,
|
GuildDeleteEvent,
|
||||||
@ -42,12 +41,13 @@ import {
|
|||||||
GuildMemberUpdateEvent,
|
GuildMemberUpdateEvent,
|
||||||
MessageCreateEvent,
|
MessageCreateEvent,
|
||||||
} from "../interfaces";
|
} from "../interfaces";
|
||||||
import { HTTPError } from "lambert-server";
|
import { Config, emitEvent } from "../util";
|
||||||
import { Role } from "./Role";
|
|
||||||
import { BaseClassWithoutId } from "./BaseClass";
|
|
||||||
import { Ban, PublicGuildRelations } from ".";
|
|
||||||
import { DiscordApiErrors } from "../util/Constants";
|
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)[] = [
|
export const MemberPrivateProjection: (keyof Member)[] = [
|
||||||
"id",
|
"id",
|
||||||
@ -326,7 +326,7 @@ export class Member extends BaseClassWithoutId {
|
|||||||
where: {
|
where: {
|
||||||
id: guild_id,
|
id: guild_id,
|
||||||
},
|
},
|
||||||
relations: [...PublicGuildRelations, "system_channel"],
|
relations: PublicGuildRelations,
|
||||||
});
|
});
|
||||||
|
|
||||||
const memberCount = await Member.count({ where: { guild_id } });
|
const memberCount = await Member.count({ where: { guild_id } });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user