summary refs log tree commit diff
path: root/src/Server.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-10 14:37:16 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-10 14:37:16 +0100
commit38757c60e119c29e3b501ae2f68825d7fa8cec94 (patch)
treebb9201aa0a7b7e5a962753fab832b7f3bdb51c4f /src/Server.ts
parentMerge branch 'main' of https://github.com/discord-open-source/discord-gateway... (diff)
downloadserver-38757c60e119c29e3b501ae2f68825d7fa8cec94.tar.xz
update import to fosscord-server-util
Diffstat (limited to 'src/Server.ts')
-rw-r--r--src/Server.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Server.ts b/src/Server.ts

index 3598c8e1..3bd10928 100644 --- a/src/Server.ts +++ b/src/Server.ts
@@ -1,6 +1,7 @@ -import { db } from "discord-server-util"; +import { db } from "fosscord-server-util"; import { Server as WebSocketServer } from "ws"; import { Connection } from "./events/Connection"; +import Config from "./util/Config"; export class Server { public ws: WebSocketServer; @@ -9,8 +10,15 @@ export class Server { this.ws.on("connection", Connection); } + async setupSchema() { + // TODO: adjust expireAfterSeconds -> lower + await db.conn.db.collection("events").createIndex({ created_at: 1 }, { expireAfterSeconds: 60 }); + } + async listen(): Promise<void> { await db.init(); + await this.setupSchema(); + await Config.init(); console.log("listening"); } }