From c8f6679aebe07662876589155e48d613088e0551 Mon Sep 17 00:00:00 2001 From: Vlad Rud Date: Tue, 17 Aug 2021 11:17:51 +0300 Subject: [PATCH] Fixed CarmaShots filtering --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 26c5e63..2b77988 100644 --- a/index.js +++ b/index.js @@ -25,9 +25,10 @@ const markdowned = s => { } let CarmaShots = [] +const clearInterval = 1000 * 60 * 5 setInterval(() => { - const oldShots = CarmaShots.filter() -}, 1000 * 60 * 5) + CarmaShots = CarmaShots.filter(obj => (Date.now() - obj.date) < clearInterval) +}, clearInterval) const mongo_uri = "mongodb://"+process.env.MONGO_HOST+"/godot" mongoose.connect(mongo_uri, {useNewUrlParser: true, useUnifiedTopology: true})