From 9e167724f7e933f41d9ea2e1c31772bf4c560a28 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 21 Feb 2017 21:35:59 +0100 Subject: Server: make a basic "quick and dirty update" for videos This system will be useful to to update some int video attributes (likes, dislikes, views...) The classic system is not used because we need some optimization for scaling --- server/initializers/constants.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'server/initializers/constants.js') diff --git a/server/initializers/constants.js b/server/initializers/constants.js index 821580893..668bfe56c 100644 --- a/server/initializers/constants.js +++ b/server/initializers/constants.js @@ -5,7 +5,7 @@ const path = require('path') // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 10 +const LAST_MIGRATION_VERSION = 15 // --------------------------------------------------------------------------- @@ -24,7 +24,7 @@ const SEARCHABLE_COLUMNS = { const SORTABLE_COLUMNS = { USERS: [ 'id', '-id', 'username', '-username', 'createdAt', '-createdAt' ], VIDEO_ABUSES: [ 'id', '-id', 'createdAt', '-createdAt' ], - VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdAt', '-createdAt' ] + VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdAt', '-createdAt', 'views', '-views' ] } const OAUTH_LIFETIME = { @@ -116,11 +116,16 @@ const REQUESTS_LIMIT_PODS = 10 // How many requests we send to a pod per interval const REQUESTS_LIMIT_PER_POD = 5 +const REQUESTS_VIDEO_QADU_LIMIT_PODS = 10 +// The QADU requests are not big +const REQUESTS_VIDEO_QADU_LIMIT_PER_POD = 50 + // Number of requests to retry for replay requests module const RETRY_REQUESTS = 5 const REQUEST_ENDPOINTS = { - VIDEOS: 'videos' + VIDEOS: 'videos', + QADU: 'videos/qadu' } const REQUEST_ENDPOINT_ACTIONS = {} REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] = { @@ -130,6 +135,12 @@ REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] = { REPORT_ABUSE: 'report-abuse' } +const REQUEST_VIDEO_QADU_TYPES = { + LIKES: 'likes', + DISLIKES: 'dislikes', + VIEWS: 'views' +} + const REMOTE_SCHEME = { HTTP: 'https', WS: 'wss' @@ -199,10 +210,13 @@ module.exports = { REMOTE_SCHEME, REQUEST_ENDPOINT_ACTIONS, REQUEST_ENDPOINTS, + REQUEST_VIDEO_QADU_TYPES, REQUESTS_IN_PARALLEL, REQUESTS_INTERVAL, REQUESTS_LIMIT_PER_POD, REQUESTS_LIMIT_PODS, + REQUESTS_VIDEO_QADU_LIMIT_PER_POD, + REQUESTS_VIDEO_QADU_LIMIT_PODS, RETRY_REQUESTS, SEARCHABLE_COLUMNS, SIGNATURE_ALGORITHM, -- cgit v1.2.3