aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/files-cache
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-06 17:19:53 +0200
committerChocobozzz <me@florianbigard.com>2019-08-06 17:26:51 +0200
commit6b9c966f6428c9e47bead3410a0401e8ebd744bf (patch)
tree282218ec56725b0e2e878b0471cd08a54fd91998 /server/lib/files-cache
parent466e3f20a537f1eff4b4fd03297df11ba371d049 (diff)
downloadPeerTube-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.ts28
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