overleaf/services/document-updater/scripts/flush_all.js
Miguel Serrano 909bb99b9f [CE/SP] Flush redis on docker stop (#11714)
* [CE/SP] Flush redis on `docker stop`

* Extracted `limit` to variable

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

* Increased logging

---------

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
GitOrigin-RevId: 4bcb4e70988337369acca0e80f243609bd6323ed
2023-02-09 09:06:37 +00:00

28 lines
597 B
JavaScript

const ProjectFlusher = require('../app/js/ProjectFlusher')
async function main() {
console.log('Flushing all projects')
return new Promise((resolve, reject) => {
const options = {
limit: 100000,
concurrency: 5,
}
ProjectFlusher.flushAllProjects(options, err => {
if (err) {
reject(err)
} else {
resolve()
}
})
})
}
main()
.then(() => {
console.log('Done flushing all projects')
process.exit(0)
})
.catch(error => {
console.error('There was an error flushing all projects', { error })
process.exit(1)
})