]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/lib/schedulers/bad-actor-follow-scheduler.ts
Automatically jump to the highlighted thread
[github/Chocobozzz/PeerTube.git] / server / lib / schedulers / bad-actor-follow-scheduler.ts
CommitLineData
6fdc553a 1import { isTestInstance } from '../../helpers/core-utils'
60650c77
C
2import { logger } from '../../helpers/logger'
3import { ActorFollowModel } from '../../models/activitypub/actor-follow'
4import { AbstractScheduler } from './abstract-scheduler'
5
6export class BadActorFollowScheduler extends AbstractScheduler {
7
8 private static instance: AbstractScheduler
9
10 private constructor () {
11 super()
12 }
13
14 async execute () {
6fdc553a 15 if (!isTestInstance()) logger.info('Removing bad actor follows (scheduler).')
ea99d15f 16
60650c77
C
17 try {
18 await ActorFollowModel.removeBadActorFollows()
19 } catch (err) {
d5b7d911 20 logger.error('Error in bad actor follows scheduler.', { err })
60650c77
C
21 }
22 }
23
24 static get Instance () {
25 return this.instance || (this.instance = new this())
26 }
27}