updating so it removes from redis after massive file uploaded

This commit is contained in:
unknown 2023-03-10 19:24:51 +01:00
parent 7ba142580a
commit 8aebe67620
2 changed files with 6 additions and 9 deletions

View File

@ -148,8 +148,6 @@ exports.playlist = async (ws, req) => {
await redis.del(id) await redis.del(id)
continue continue
} else { } else {
await redis.del(id)
const file = fs.readdirSync("./videos").find(f => f.includes(id)) const file = fs.readdirSync("./videos").find(f => f.includes(id))
if (file) { if (file) {
fs.renameSync(`./videos/${file}`, `./videos/${id}.webm`) 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}`) ws.send(`DATA - Created video page for ${video.title}`)
} else { } else {
ws.send(`DATA - Failed to find file for ${video.title}. Going to next video in the playlist`) 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) await redis.del(id)
continue continue
} else { } else {
await redis.del(id)
const file = fs.readdirSync("./videos").find(f => f.includes(id)) const file = fs.readdirSync("./videos").find(f => f.includes(id))
if (file) { if (file) {
fs.renameSync(`./videos/${file}`, `./videos/${id}.webm`) 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}`) ws.send(`DATA - Created video page for ${video.title}`)
} else { } else {
ws.send(`DATA - Failed to find file for ${video.title}. Going to next video`) ws.send(`DATA - Failed to find file for ${video.title}. Going to next video`)
continue
} }
await redis.del(id)
} }
} }

View File

@ -42,8 +42,6 @@ async function handleDownload(channelId) {
await redis.del(id) await redis.del(id)
continue continue
} else { } else {
await redis.del(id)
const file = fs.readdirSync("./videos").find(f => f.includes(id)) const file = fs.readdirSync("./videos").find(f => f.includes(id))
if (file) { if (file) {
fs.renameSync(`./videos/${file}`, `./videos/${id}.webm`) fs.renameSync(`./videos/${file}`, `./videos/${id}.webm`)
@ -56,8 +54,9 @@ async function handleDownload(channelId) {
await websocket.createDatabaseVideo(id, videoUrl) await websocket.createDatabaseVideo(id, videoUrl)
} else { } else {
logger.info({ message: `Couldn't find file for ${video.title}, ${id}` }) logger.info({ message: `Couldn't find file for ${video.title}, ${id}` })
continue
} }
await redis.del(id)
} }
} }
} }