Hourly check for possible stale sizePurge lock+
parent
107893d058
commit
fe3121a7a8
39
libs/user.js
39
libs/user.js
|
@ -322,20 +322,29 @@ 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)
|
||||
if(config.cron.deleteOverMax === true){
|
||||
s.checkForStalePurgeLocks = function(){
|
||||
var doCheck = function(){
|
||||
Object.keys(s.group).forEach(function(groupKey){
|
||||
var userGroup = s.group[groupKey]
|
||||
var monitorCount = 10
|
||||
if(userGroup.mon)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)
|
||||
}
|
||||
})
|
||||
}
|
||||
clearTimeout(s.checkForStalePurgeLocksInterval)
|
||||
s.checkForStalePurgeLocksInterval = setInterval(function(){
|
||||
doCheck()
|
||||
},1000 * 60 * 60)
|
||||
doCheck()
|
||||
}
|
||||
}else{
|
||||
s.checkForStalePurgeLocks = function(){}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue