You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
main
${ noResults }
31 lines
940 B
TypeScript
31 lines
940 B
TypeScript
import { logger } from '../../helpers/logger.js'
|
|||
import { AbstractScheduler } from './abstract-scheduler.js'
|
|||
import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'
|
|||
import { CONFIG } from '../../initializers/config.js'
|
|||
import { UserExportModel } from '@server/models/user/user-export.js'
|
|||
|
|||
export class RemoveExpiredUserExportsScheduler extends AbstractScheduler {
|
|||
|
|||
private static instance: AbstractScheduler
|
|||
|
|||
protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.REMOVE_EXPIRED_USER_EXPORTS
|
|||
|
|||
private constructor () {
|
|||
super()
|
|||
}
|
|||
|
|||
protected async internalExecute () {
|
|||
const expired = await UserExportModel.listExpired(CONFIG.EXPORT.USERS.EXPORT_EXPIRATION)
|
|||
|
|||
for (const userExport of expired) {
|
|||
logger.info('Removing expired user exports ' + userExport.filename)
|
|||
|
|||
await userExport.destroy()
|
|||
}
|
|||
}
|
|||
|
|||
static get Instance () {
|
|||
return this.instance || (this.instance = new this())
|
|||
}
|
|||
}
|