From 6a96f23040ea79deac461e9878470496e5399b65 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 13 Feb 2022 07:16:15 +0300 Subject: [PATCH] Update cleanup.js --- scripts/commands/database/cleanup.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/commands/database/cleanup.js b/scripts/commands/database/cleanup.js index ede11d701..5b23f5233 100644 --- a/scripts/commands/database/cleanup.js +++ b/scripts/commands/database/cleanup.js @@ -9,12 +9,12 @@ async function main() { let removed = 0 const buffer = {} for (const stream of streams) { - const duplicate = buffer[stream.channel_id] - if (duplicate && ['offline', 'timeout'].includes(stream.status.code)) { + const duplicate = buffer[stream.channel] + if (duplicate && !stream.is_online) { await db.streams.remove({ _id: stream._id }) removed++ } else { - buffer[stream.channel_id] = stream + buffer[stream.channel] = stream } } db.streams.compact()