auto delete expired updates
This commit is contained in:
parent
ed4e15e8e5
commit
f05ae776b9
|
@ -280,6 +280,15 @@ const runCron = async () => {
|
|||
.find({ open: true })
|
||||
.toArray()
|
||||
|
||||
const updates: any[] = await db
|
||||
.collection("updates")
|
||||
.find({ expiryDate: { $lt: Date.now() } })
|
||||
.toArray()
|
||||
|
||||
updates.forEach(async (update) => {
|
||||
db.collection("updates").deleteOne({ _id: update._id })
|
||||
})
|
||||
|
||||
alerts.forEach(async (alert) => {
|
||||
handleAlert(alert, db)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue