From 9d1f7e0991a1b5123af10b38774235d116bf3465 Mon Sep 17 00:00:00 2001 From: Moe Date: Mon, 29 Nov 2021 21:14:57 -0800 Subject: [PATCH] disable scanForOrphanedVideos on child node completely --- libs/video/utils.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libs/video/utils.js b/libs/video/utils.js index c36d21c5..49830148 100644 --- a/libs/video/utils.js +++ b/libs/video/utils.js @@ -1,6 +1,13 @@ const fs = require('fs') const { spawn } = require('child_process') module.exports = (s,config,lang) => { + const isMasterNode = ( + ( + config.childNodes.enabled === true && + config.childNodes.mode === 'master' + ) || + config.childNodes.enabled === false + ); // orphanedVideoCheck : new function const checkIfVideoIsOrphaned = (monitor,videosDirectory,filename) => { const response = {ok: true} @@ -40,7 +47,7 @@ module.exports = (s,config,lang) => { }) }) } - const scanForOrphanedVideos = (monitor,options) => { + let scanForOrphanedVideos = (monitor,options) => { // const options = { // checkMax: 2 // } @@ -115,6 +122,11 @@ module.exports = (s,config,lang) => { } }) } + if(!isMasterNode){ + scanForOrphanedVideos = async () => { + return {ok: true, orphanedFilesCount: 0} + } + } // orphanedVideoCheck : old function const orphanedVideoCheck = (monitor,checkMax,callback,forceCheck) => { var finish = function(orphanedFilesCount){