Hourly check for possible stale sizePurge lock
parent
79e3632b88
commit
107893d058
|
@ -26,9 +26,9 @@ loadLib('codeTester')(s,config,lang,io)
|
|||
//basic functions
|
||||
loadLib('basic')(s,config)
|
||||
//video processing engine
|
||||
loadLib('ffmpeg')(s,config,function(){
|
||||
loadLib('ffmpeg')(s,config,function(ffmpeg){
|
||||
//ffmpeg coProcessor
|
||||
loadLib('ffmpegCoProcessor')(s,config,lang)
|
||||
loadLib('ffmpegCoProcessor')(s,config,lang,ffmpeg)
|
||||
//database connection : mysql, sqlite3..
|
||||
loadLib('sql')(s,config)
|
||||
//working directories : videos, streams, fileBin..
|
||||
|
|
|
@ -422,6 +422,8 @@
|
|||
"deleteMonitorStateText2": "Do you want to delete this Monitor's Preset?",
|
||||
"Preset": "Preset",
|
||||
"Presets": "Presets",
|
||||
"possibleInternalError": "Possible Internal Error",
|
||||
"sizePugeLockedText": "The Size Purge Lock (deleteOverMax) appears to have failed to unlock. Unlocking now...",
|
||||
"Use coProcessor": "Use coProcessor",
|
||||
"Audio Codec": "Audio Codec",
|
||||
"Video Record Rate": "Video Record Rate <small>(FPS)</small>",
|
||||
|
|
|
@ -168,6 +168,9 @@ module.exports = function(s,config,lang,io,){
|
|||
})
|
||||
})
|
||||
},10000)
|
||||
//hourly check to see if sizePurge has failed to unlock
|
||||
//checks to see if request count is the number of monitors + 10
|
||||
s.checkForStalePurgeLocks()
|
||||
//run prerequsite queries, load users and monitors
|
||||
if(config.childNodes.mode !== 'child'){
|
||||
//sql/database connection with knex
|
||||
|
|
18
libs/user.js
18
libs/user.js
|
@ -15,7 +15,7 @@ module.exports = function(s,config){
|
|||
if(s.group[e.ke].sizePurgeQueue.length > 0){
|
||||
checkQueue()
|
||||
}else{
|
||||
s.group[e.ke].sizePurging=false
|
||||
s.group[e.ke].sizePurging = false
|
||||
s.sendDiskUsedAmountToClients(e)
|
||||
}
|
||||
}
|
||||
|
@ -322,4 +322,20 @@ module.exports = function(s,config){
|
|||
callback(notFound,preset)
|
||||
})
|
||||
}
|
||||
s.checkForStalePurgeLocks = function(){
|
||||
clearTimeout(s.checkForStalePurgeLocksInterval)
|
||||
s.checkForStalePurgeLocksInterval = setInterval(function(){
|
||||
Object.keys(s.group).forEach(function(groupKey){
|
||||
var userGroup = s.group[groupKey]
|
||||
var monitorCount = Object.keys(userGroup.mon).length
|
||||
var purgeRequestCount = userGroup.sizePurgeQueue.length
|
||||
var isLocked = (userGroup.sizePurging === true)
|
||||
if(isLocked && purgeRequestCount > monitorCount + 10){
|
||||
s.group[groupKey].sizePurgeQueue = []
|
||||
s.group[groupKey].sizePurging = false
|
||||
s.systemLog(lang.sizePugeLockedText + ' : ' + groupKey)
|
||||
}
|
||||
})
|
||||
},1000 * 60 * 60)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -622,4 +622,16 @@ module.exports = function(s,config,lang,app){
|
|||
}
|
||||
},res,req)
|
||||
})
|
||||
/**
|
||||
* API : Superuser : Force Check for Stale Purge Locks
|
||||
*/
|
||||
app.all(config.webPaths.superApiPrefix+':auth/system/checkForStalePurgeLocks', function (req,res){
|
||||
s.superAuth(req.params,function(resp){
|
||||
var endData = {
|
||||
ok : true
|
||||
}
|
||||
s.checkForStalePurgeLocks()
|
||||
res.end(s.prettyPrint(endData))
|
||||
},res,req)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue