From 38757c60e119c29e3b501ae2f68825d7fa8cec94 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Wed, 10 Feb 2021 14:37:16 +0100 Subject: update import to fosscord-server-util --- src/Server.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Server.ts') 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 { await db.init(); + await this.setupSchema(); + await Config.init(); console.log("listening"); } } -- cgit 1.5.1