mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Improve viewer counter
More precise, avoid weird decrease, reuse an id to federate viewers
This commit is contained in:
parent
dfbcefc20d
commit
ac907dc7c1
17 changed files with 235 additions and 156 deletions
|
@ -145,18 +145,10 @@ class Redis {
|
|||
return this.setValue(this.generateIPViewKey(ip, videoUUID), '1', VIEW_LIFETIME.VIEW)
|
||||
}
|
||||
|
||||
setIPVideoViewer (ip: string, videoUUID: string) {
|
||||
return this.setValue(this.generateIPViewerKey(ip, videoUUID), '1', VIEW_LIFETIME.VIEWER_COUNTER)
|
||||
}
|
||||
|
||||
async doesVideoIPViewExist (ip: string, videoUUID: string) {
|
||||
return this.exists(this.generateIPViewKey(ip, videoUUID))
|
||||
}
|
||||
|
||||
async doesVideoIPViewerExist (ip: string, videoUUID: string) {
|
||||
return this.exists(this.generateIPViewerKey(ip, videoUUID))
|
||||
}
|
||||
|
||||
/* ************ Tracker IP block ************ */
|
||||
|
||||
setTrackerBlockIP (ip: string) {
|
||||
|
@ -361,10 +353,6 @@ class Redis {
|
|||
return `views-${videoUUID}-${ip}`
|
||||
}
|
||||
|
||||
private generateIPViewerKey (ip: string, videoUUID: string) {
|
||||
return `viewer-${videoUUID}-${ip}`
|
||||
}
|
||||
|
||||
private generateTrackerBlockIPKey (ip: string) {
|
||||
return `tracker-block-ip-${ip}`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue