- const exists = await Redis.Instance.doesVideoIPViewExist(ip, immutableVideoAttrs.uuid)
- if (exists) {
- logger.debug('View for ip %s and video %s already exists.', ip, immutableVideoAttrs.uuid)
- return res.status(HttpStatusCode.NO_CONTENT_204).end()
- }
-
- const video = await VideoModel.load(immutableVideoAttrs.id)
-
- const promises: Promise<any>[] = [
- Redis.Instance.setIPVideoView(ip, video.uuid, video.isLive)
- ]
-
- let federateView = true
-
- // Increment our live manager
- if (video.isLive && video.isOwned()) {
- LiveManager.Instance.addViewTo(video.id)
-
- // Views of our local live will be sent by our live manager
- federateView = false
- }
-
- // Increment our video views cache counter
- if (!video.isLive) {
- promises.push(Redis.Instance.addVideoView(video.id))
- }