diff options
Diffstat (limited to 'server/lib/redis.ts')
-rw-r--r-- | server/lib/redis.ts | 9 |
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) { |