diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-29 16:26:25 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-30 15:03:18 +0200 |
commit | 6b6168606bc86430f6b7821c9d5f1c80d0425ebf (patch) | |
tree | 9aea6cf0875c9fee30c373eb4924b12d47d1e23c /server/models/video/video.ts | |
parent | 2d9fea161fd4fc73994fc77951bafdccdc2071fd (diff) | |
download | PeerTube-6b6168606bc86430f6b7821c9d5f1c80d0425ebf.tar.gz PeerTube-6b6168606bc86430f6b7821c9d5f1c80d0425ebf.tar.zst PeerTube-6b6168606bc86430f6b7821c9d5f1c80d0425ebf.zip |
Bufferize videos views in redis
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 6271db1b3..3410833c8 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1074,6 +1074,15 @@ export class VideoModel extends Model<VideoModel> { | |||
1074 | } | 1074 | } |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | static incrementViews (id: number, views: number) { | ||
1078 | return VideoModel.increment('views', { | ||
1079 | by: views, | ||
1080 | where: { | ||
1081 | id | ||
1082 | } | ||
1083 | }) | ||
1084 | } | ||
1085 | |||
1077 | private static buildActorWhereWithFilter (filter?: VideoFilter) { | 1086 | private static buildActorWhereWithFilter (filter?: VideoFilter) { |
1078 | if (filter && filter === 'local') { | 1087 | if (filter && filter === 'local') { |
1079 | return { | 1088 | return { |