aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/redis.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-12-04 16:02:49 +0100
committerChocobozzz <me@florianbigard.com>2018-12-04 16:04:15 +0100
commit6040f87d143a5fa01db79867ece8197c3ce7be47 (patch)
tree98e5fcbced3e55df2f51421250eaa57f3c511299 /server/lib/redis.ts
parent745778256ced65415b04a9817fc49db70d4b6681 (diff)
downloadPeerTube-6040f87d143a5fa01db79867ece8197c3ce7be47.tar.gz
PeerTube-6040f87d143a5fa01db79867ece8197c3ce7be47.tar.zst
PeerTube-6040f87d143a5fa01db79867ece8197c3ce7be47.zip
Add tmp and redundancy directories
Diffstat (limited to 'server/lib/redis.ts')
-rw-r--r--server/lib/redis.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/lib/redis.ts b/server/lib/redis.ts
index abd75d512..3e25e6a2c 100644
--- a/server/lib/redis.ts
+++ b/server/lib/redis.ts
@@ -121,7 +121,14 @@ class Redis {
121 const key = this.generateVideoViewKey(videoId, hour) 121 const key = this.generateVideoViewKey(videoId, hour)
122 122
123 const valueString = await this.getValue(key) 123 const valueString = await this.getValue(key)
124 return parseInt(valueString, 10) 124 const valueInt = parseInt(valueString, 10)
125
126 if (isNaN(valueInt)) {
127 logger.error('Cannot get videos views of video %d in hour %d: views number is NaN (%s).', videoId, hour, valueString)
128 return undefined
129 }
130
131 return valueInt
125 } 132 }
126 133
127 async getVideosIdViewed (hour: number) { 134 async getVideosIdViewed (hour: number) {