diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-06 17:19:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-06 17:26:51 +0200 |
commit | 6b9c966f6428c9e47bead3410a0401e8ebd744bf (patch) | |
tree | 282218ec56725b0e2e878b0471cd08a54fd91998 /server/lib/files-cache | |
parent | 466e3f20a537f1eff4b4fd03297df11ba371d049 (diff) | |
download | PeerTube-6b9c966f6428c9e47bead3410a0401e8ebd744bf.tar.gz PeerTube-6b9c966f6428c9e47bead3410a0401e8ebd744bf.tar.zst PeerTube-6b9c966f6428c9e47bead3410a0401e8ebd744bf.zip |
Automatically remove bad followings
Diffstat (limited to 'server/lib/files-cache')
-rw-r--r-- | server/lib/files-cache/actor-follow-score-cache.ts | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/server/lib/files-cache/actor-follow-score-cache.ts b/server/lib/files-cache/actor-follow-score-cache.ts index 5f8ee806f..086605726 100644 --- a/server/lib/files-cache/actor-follow-score-cache.ts +++ b/server/lib/files-cache/actor-follow-score-cache.ts | |||
@@ -7,6 +7,8 @@ class ActorFollowScoreCache { | |||
7 | 7 | ||
8 | private static instance: ActorFollowScoreCache | 8 | private static instance: ActorFollowScoreCache |
9 | private pendingFollowsScore: { [ url: string ]: number } = {} | 9 | private pendingFollowsScore: { [ url: string ]: number } = {} |
10 | private pendingBadServer = new Set<number>() | ||
11 | private pendingGoodServer = new Set<number>() | ||
10 | 12 | ||
11 | private constructor () {} | 13 | private constructor () {} |
12 | 14 | ||
@@ -32,7 +34,31 @@ class ActorFollowScoreCache { | |||
32 | } | 34 | } |
33 | } | 35 | } |
34 | 36 | ||
35 | getPendingFollowsScoreCopy () { | 37 | addBadServerId (serverId: number) { |
38 | this.pendingBadServer.add(serverId) | ||
39 | } | ||
40 | |||
41 | getBadFollowingServerIds () { | ||
42 | return Array.from(this.pendingBadServer) | ||
43 | } | ||
44 | |||
45 | clearBadFollowingServerIds () { | ||
46 | this.pendingBadServer = new Set<number>() | ||
47 | } | ||
48 | |||
49 | addGoodServerId (serverId: number) { | ||
50 | this.pendingGoodServer.add(serverId) | ||
51 | } | ||
52 | |||
53 | getGoodFollowingServerIds () { | ||
54 | return Array.from(this.pendingGoodServer) | ||
55 | } | ||
56 | |||
57 | clearGoodFollowingServerIds () { | ||
58 | this.pendingGoodServer = new Set<number>() | ||
59 | } | ||
60 | |||
61 | getPendingFollowsScore () { | ||
36 | return this.pendingFollowsScore | 62 | return this.pendingFollowsScore |
37 | } | 63 | } |
38 | 64 | ||