]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/lib/schedulers/bad-actor-follow-scheduler.ts
Fix notification with large message
[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'
2baea0c7 5import { SCHEDULER_INTERVALS_MS } from '../../initializers'
60650c77
C
6
7export class BadActorFollowScheduler extends AbstractScheduler {
8
9 private static instance: AbstractScheduler
10
2baea0c7
C
11 protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.badActorFollow
12
60650c77
C
13 private constructor () {
14 super()
15 }
16
17 async execute () {
6fdc553a 18 if (!isTestInstance()) logger.info('Removing bad actor follows (scheduler).')
ea99d15f 19
60650c77
C
20 try {
21 await ActorFollowModel.removeBadActorFollows()
22 } catch (err) {
d5b7d911 23 logger.error('Error in bad actor follows scheduler.', { err })
60650c77
C
24 }
25 }
26
27 static get Instance () {
28 return this.instance || (this.instance = new this())
29 }
30}