Fix old event splicing

This commit is contained in:
Mikko Ahlroth 2020-04-04 18:42:21 +03:00
parent 3b6821a423
commit ed36a8a693

View file

@ -37,7 +37,7 @@ export class EventStore {
private clearOld() {
const now = Date.now();
const firstCurrent = this.events.findIndex((v) => (now - v.at.getTime()) <= CURRENT_THRESHOLD * 1000);
const deleted = this.events.splice(0, firstCurrent !== -1 ? firstCurrent : undefined);
const deleted = this.events.splice(0, firstCurrent !== -1 ? firstCurrent : this.events.length);
for (const deletedEvent of deleted) {
for (const listener of this.listeners) {