Channels now store 1000 messages maximum

Will drastically improve the longevity of the process and reduce memory
required
This commit is contained in:
hydrabolt
2015-09-26 21:28:09 +01:00
parent 3e9af4454d
commit 1ef4fa41a7

View File

@@ -18,9 +18,15 @@ class Channel {
} }
addMessage(data){ addMessage(data){
if(this.messages.length > 1000){
this.messages.splice(0,1);
}
if(!this.getMessage("id", data.id)){ if(!this.getMessage("id", data.id)){
this.messages.push(data); this.messages.push(data);
} }
return this.getMessage("id", data.id); return this.getMessage("id", data.id);
} }