mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-25 20:52:06 +00:00
Merge pull request #7360 from overleaf/ho-purge-sess-improvements
improve the purge sessions script a bit GitOrigin-RevId: 3b211c1377bc6aa117d3f872a829bb87b16fd9e5
This commit is contained in:
parent
35538da3fa
commit
380ba96a8b
1 changed files with 5 additions and 3 deletions
|
@ -17,6 +17,9 @@ const queue = async.queue(function (sessKey, callback) {
|
|||
} else {
|
||||
redis.del(sessKey, () => {
|
||||
totalDeletedSessions++
|
||||
if (totalDeletedSessions % 1000 === 0) {
|
||||
console.log(`Keys deleted so far: ${totalDeletedSessions}`)
|
||||
}
|
||||
cb()
|
||||
})
|
||||
}
|
||||
|
@ -25,18 +28,17 @@ const queue = async.queue(function (sessKey, callback) {
|
|||
cb()
|
||||
}
|
||||
})
|
||||
}, 10)
|
||||
}, 20)
|
||||
|
||||
function scanAndPurge(cb) {
|
||||
const stream = redis.scanStream({
|
||||
match: 'sess:*',
|
||||
count: 100,
|
||||
count: 1000,
|
||||
})
|
||||
console.log('starting scan')
|
||||
|
||||
stream.on('data', resultKeys => {
|
||||
console.log(`Keys found, count:${resultKeys.length}`)
|
||||
console.log(`Keys deleted so far: ${totalDeletedSessions}`)
|
||||
queue.push(resultKeys)
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue