From 8aebe67620fb6de2ae72881727b0dac2388474d7 Mon Sep 17 00:00:00 2001 From: unknown <89595418+unknownsrc@users.noreply.github.com> Date: Fri, 10 Mar 2023 19:24:51 +0100 Subject: [PATCH] updating so it removes from redis after massive file uploaded --- controller/websocket.js | 10 ++++------ utils/auto.js | 5 ++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/controller/websocket.js b/controller/websocket.js index 3b6174d..0b57d56 100644 --- a/controller/websocket.js +++ b/controller/websocket.js @@ -148,8 +148,6 @@ exports.playlist = async (ws, req) => { await redis.del(id) continue } else { - await redis.del(id) - const file = fs.readdirSync("./videos").find(f => f.includes(id)) if (file) { fs.renameSync(`./videos/${file}`, `./videos/${id}.webm`) @@ -164,8 +162,9 @@ exports.playlist = async (ws, req) => { ws.send(`DATA - Created video page for ${video.title}`) } else { ws.send(`DATA - Failed to find file for ${video.title}. Going to next video in the playlist`) - continue } + + await redis.del(id) } } @@ -232,8 +231,6 @@ exports.channel = async (ws, req) => { await redis.del(id) continue } else { - await redis.del(id) - const file = fs.readdirSync("./videos").find(f => f.includes(id)) if (file) { fs.renameSync(`./videos/${file}`, `./videos/${id}.webm`) @@ -248,8 +245,9 @@ exports.channel = async (ws, req) => { ws.send(`DATA - Created video page for ${video.title}`) } else { ws.send(`DATA - Failed to find file for ${video.title}. Going to next video`) - continue } + + await redis.del(id) } } diff --git a/utils/auto.js b/utils/auto.js index b9d2540..c8d9d84 100644 --- a/utils/auto.js +++ b/utils/auto.js @@ -42,8 +42,6 @@ async function handleDownload(channelId) { await redis.del(id) continue } else { - await redis.del(id) - const file = fs.readdirSync("./videos").find(f => f.includes(id)) if (file) { fs.renameSync(`./videos/${file}`, `./videos/${id}.webm`) @@ -56,8 +54,9 @@ async function handleDownload(channelId) { await websocket.createDatabaseVideo(id, videoUrl) } else { logger.info({ message: `Couldn't find file for ${video.title}, ${id}` }) - continue } + + await redis.del(id) } } }