mirror of https://github.com/requarks/wiki
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
539 B
18 lines
539 B
2 years ago
|
import { DateTime } from 'luxon'
|
||
2 years ago
|
|
||
2 years ago
|
export async function task (payload) {
|
||
2 years ago
|
WIKI.logger.info('Cleaning scheduler job history...')
|
||
|
|
||
|
try {
|
||
|
await WIKI.db.knex('jobHistory')
|
||
|
.whereNot('state', 'active')
|
||
|
.andWhere('startedAt', '<=', DateTime.utc().minus({ seconds: WIKI.config.scheduler.historyExpiration }).toISO())
|
||
|
.del()
|
||
|
|
||
|
WIKI.logger.info('Cleaned scheduler job history: [ COMPLETED ]')
|
||
|
} catch (err) {
|
||
|
WIKI.logger.error('Cleaning scheduler job history: [ FAILED ]')
|
||
|
WIKI.logger.error(err.message)
|
||
|
}
|
||
|
}
|