aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r--server/controllers/api/videos/index.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index a86cf4f99..be803490b 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -380,14 +380,16 @@ async function viewVideo (req: express.Request, res: express.Response) {
380 const videoInstance = res.locals.video 380 const videoInstance = res.locals.video
381 381
382 const ip = req.ip 382 const ip = req.ip
383 const exists = await Redis.Instance.isViewExists(ip, videoInstance.uuid) 383 const exists = await Redis.Instance.isVideoIPViewExists(ip, videoInstance.uuid)
384 if (exists) { 384 if (exists) {
385 logger.debug('View for ip %s and video %s already exists.', ip, videoInstance.uuid) 385 logger.debug('View for ip %s and video %s already exists.', ip, videoInstance.uuid)
386 return res.status(204).end() 386 return res.status(204).end()
387 } 387 }
388 388
389 await videoInstance.increment('views') 389 await Promise.all([
390 await Redis.Instance.setView(ip, videoInstance.uuid) 390 Redis.Instance.addVideoView(videoInstance.id),
391 Redis.Instance.setIPVideoView(ip, videoInstance.uuid)
392 ])
391 393
392 const serverAccount = await getServerActor() 394 const serverAccount = await getServerActor()
393 395