Create scripts/commands
This commit is contained in:
14
scripts/commands/cleanup-database.js
Normal file
14
scripts/commands/cleanup-database.js
Normal file
@ -0,0 +1,14 @@
|
||||
const { db, logger } = require('../core')
|
||||
|
||||
async function main() {
|
||||
const removed = await db.remove(
|
||||
{ 'status.code': { $in: ['timeout', 'offline'] } },
|
||||
{ multi: true }
|
||||
)
|
||||
|
||||
db.compact()
|
||||
|
||||
logger.info(`Removed ${removed} links`)
|
||||
}
|
||||
|
||||
main()
|
Reference in New Issue
Block a user