aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/redis.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-06 16:42:23 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commite4bf78561763cd84d22ebceb6f371cccf9a356d8 (patch)
tree7d8ea6ed53810d1dfcc2cfa5e3150da8e87e4645 /server/lib/redis.ts
parent529f037294d9917a62235f8162887a8edc04c32f (diff)
downloadPeerTube-e4bf78561763cd84d22ebceb6f371cccf9a356d8.tar.gz
PeerTube-e4bf78561763cd84d22ebceb6f371cccf9a356d8.tar.zst
PeerTube-e4bf78561763cd84d22ebceb6f371cccf9a356d8.zip
Handle views for live videos
Diffstat (limited to 'server/lib/redis.ts')
-rw-r--r--server/lib/redis.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/lib/redis.ts b/server/lib/redis.ts
index a075eee2d..4325598b2 100644
--- a/server/lib/redis.ts
+++ b/server/lib/redis.ts
@@ -7,7 +7,7 @@ import {
7 USER_EMAIL_VERIFY_LIFETIME, 7 USER_EMAIL_VERIFY_LIFETIME,
8 USER_PASSWORD_RESET_LIFETIME, 8 USER_PASSWORD_RESET_LIFETIME,
9 USER_PASSWORD_CREATE_LIFETIME, 9 USER_PASSWORD_CREATE_LIFETIME,
10 VIDEO_VIEW_LIFETIME, 10 VIEW_LIFETIME,
11 WEBSERVER, 11 WEBSERVER,
12 TRACKER_RATE_LIMITS 12 TRACKER_RATE_LIMITS
13} from '../initializers/constants' 13} from '../initializers/constants'
@@ -118,8 +118,12 @@ class Redis {
118 118
119 /* ************ Views per IP ************ */ 119 /* ************ Views per IP ************ */
120 120
121 setIPVideoView (ip: string, videoUUID: string) { 121 setIPVideoView (ip: string, videoUUID: string, isLive: boolean) {
122 return this.setValue(this.generateViewKey(ip, videoUUID), '1', VIDEO_VIEW_LIFETIME) 122 const lifetime = isLive
123 ? VIEW_LIFETIME.LIVE
124 : VIEW_LIFETIME.VIDEO
125
126 return this.setValue(this.generateViewKey(ip, videoUUID), '1', lifetime)
123 } 127 }
124 128
125 async doesVideoIPViewExist (ip: string, videoUUID: string) { 129 async doesVideoIPViewExist (ip: string, videoUUID: string) {