diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-20 14:31:11 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-12-20 14:31:11 +0100 |
commit | 2f5c6b2fc6e60502c2a8df4dc9029c1d87ebe30b (patch) | |
tree | 9b83f018403c30421c1b3ca4439c4dddc5077881 /server/lib/schedulers/bad-actor-follow-scheduler.ts | |
parent | 4707f410ae44b55e17e1758693dd21cff03b7ef1 (diff) | |
download | PeerTube-2f5c6b2fc6e60502c2a8df4dc9029c1d87ebe30b.tar.gz PeerTube-2f5c6b2fc6e60502c2a8df4dc9029c1d87ebe30b.tar.zst PeerTube-2f5c6b2fc6e60502c2a8df4dc9029c1d87ebe30b.zip |
Optimize actor follow scores modifications
Diffstat (limited to 'server/lib/schedulers/bad-actor-follow-scheduler.ts')
-rw-r--r-- | server/lib/schedulers/bad-actor-follow-scheduler.ts | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/server/lib/schedulers/bad-actor-follow-scheduler.ts b/server/lib/schedulers/bad-actor-follow-scheduler.ts deleted file mode 100644 index 617149aaf..000000000 --- a/server/lib/schedulers/bad-actor-follow-scheduler.ts +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | import { isTestInstance } from '../../helpers/core-utils' | ||
2 | import { logger } from '../../helpers/logger' | ||
3 | import { ActorFollowModel } from '../../models/activitypub/actor-follow' | ||
4 | import { AbstractScheduler } from './abstract-scheduler' | ||
5 | import { SCHEDULER_INTERVALS_MS } from '../../initializers' | ||
6 | |||
7 | export class BadActorFollowScheduler extends AbstractScheduler { | ||
8 | |||
9 | private static instance: AbstractScheduler | ||
10 | |||
11 | protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.badActorFollow | ||
12 | |||
13 | private constructor () { | ||
14 | super() | ||
15 | } | ||
16 | |||
17 | async execute () { | ||
18 | if (!isTestInstance()) logger.info('Removing bad actor follows (scheduler).') | ||
19 | |||
20 | try { | ||
21 | await ActorFollowModel.removeBadActorFollows() | ||
22 | } catch (err) { | ||
23 | logger.error('Error in bad actor follows scheduler.', { err }) | ||
24 | } | ||
25 | } | ||
26 | |||
27 | static get Instance () { | ||
28 | return this.instance || (this.instance = new this()) | ||
29 | } | ||
30 | } | ||