Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
feat(GuildCreateListener): add GUILD_CREATE_GC_EVERY option (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazmi35 authored Feb 21, 2024
1 parent 69b1e0f commit 39397ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion services/kanao-gateway/.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ STORE_LOGS=true
LOKI_HOST=http://localhost:3100 # (optional)

REPLICA_ID=0
REPLICA_COUNT=1
REPLICA_COUNT=1

# Do a garbage collection on guildCreate after x times
# Useful on startups
GUILD_CREATE_GC_EVERY=
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { GatewayDispatchEvents } from "discord-api-types/v10";
import { sql } from "drizzle-orm";
import type { ListenerContext } from "../../../Stores/Listener.js";
import { Listener } from "../../../Stores/Listener.js";
import { clientId, stateChannels, stateRoles } from "../../../config.js";
import { clientId, guildCreateGcEvery, stateChannels, stateRoles } from "../../../config.js";

export class GuildCreateListener extends Listener {
public count = 0;
public gcEvery = 50;
public gcEvery = guildCreateGcEvery;
public constructor(context: ListenerContext) {
super(context, {
event: GatewayDispatchEvents.GuildCreate
Expand Down
2 changes: 2 additions & 0 deletions services/kanao-gateway/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,5 @@ export const replicaId = hostname();
export const replicaCount = Number(process.env.GATEWAY_REPLICA_COUNT ?? "1");

export const databaseUrl = process.env.DATABASE_GATEWAY_URL ?? process.env.DATABASE_URL!;

export const guildCreateGcEvery = Number(process.env.GUILD_CREATE_GC_EVERY ?? 50);

0 comments on commit 39397ed

Please sign in to comment.