2023-02-08 10:02:21 -05:00
|
|
|
const UpdatesManager = require('../app/js/UpdatesManager')
|
2023-02-13 05:02:11 -05:00
|
|
|
const { waitForDb } = require('../app/js/mongodb')
|
2023-02-08 10:02:21 -05:00
|
|
|
|
|
|
|
async function main() {
|
2023-02-13 05:02:11 -05:00
|
|
|
await waitForDb()
|
2023-02-08 10:02:21 -05:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
const limit = -1
|
|
|
|
console.log('Flushing all updates')
|
|
|
|
UpdatesManager.flushAll(limit, err => {
|
|
|
|
if (err) {
|
|
|
|
reject(err)
|
|
|
|
} else {
|
|
|
|
resolve()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|
|
|
|
.then(() => {
|
|
|
|
console.log('Done flushing all updates')
|
|
|
|
process.exit(0)
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
console.error('There was an error flushing updates', { error })
|
|
|
|
process.exit(1)
|
|
|
|
})
|