From 1ef4fa41a77f33af882baa140b2e6084d2f4a233 Mon Sep 17 00:00:00 2001 From: hydrabolt Date: Sat, 26 Sep 2015 21:28:09 +0100 Subject: [PATCH] Channels now store 1000 messages maximum Will drastically improve the longevity of the process and reduce memory required --- src/channel.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/channel.js b/src/channel.js index d813e9b74..91e961547 100644 --- a/src/channel.js +++ b/src/channel.js @@ -18,9 +18,15 @@ class Channel { } addMessage(data){ + + if(this.messages.length > 1000){ + this.messages.splice(0,1); + } + if(!this.getMessage("id", data.id)){ this.messages.push(data); } + return this.getMessage("id", data.id); }