aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/request
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-11 16:01:56 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-11 16:01:56 +0200
commit0a6658fdcbd779ada8f3758048c326e997902d5a (patch)
tree5de40bf901db0299011104b1344783637b964eb0 /server/lib/request
parente6d4b0ff2404dcf0b3a755c3fcc415ffeb6e754d (diff)
downloadPeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.tar.gz
PeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.tar.zst
PeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.zip
Use global uuid instead of remoteId for videos
Diffstat (limited to 'server/lib/request')
-rw-r--r--server/lib/request/request-video-event-scheduler.ts16
-rw-r--r--server/lib/request/request-video-qadu-scheduler.ts16
2 files changed, 16 insertions, 16 deletions
diff --git a/server/lib/request/request-video-event-scheduler.ts b/server/lib/request/request-video-event-scheduler.ts
index 8a008c51b..680232732 100644
--- a/server/lib/request/request-video-event-scheduler.ts
+++ b/server/lib/request/request-video-event-scheduler.ts
@@ -12,7 +12,7 @@ import { RequestVideoEventType, RemoteVideoEventRequest, RemoteVideoEventType }
12 12
13export type RequestVideoEventSchedulerOptions = { 13export type RequestVideoEventSchedulerOptions = {
14 type: RequestVideoEventType 14 type: RequestVideoEventType
15 videoId: string 15 videoId: number
16 count?: number 16 count?: number
17 transaction?: Sequelize.Transaction 17 transaction?: Sequelize.Transaction
18} 18}
@@ -49,7 +49,7 @@ class RequestVideoEventScheduler extends AbstractRequestScheduler<RequestsVideoE
49 */ 49 */
50 const eventsPerVideoPerPod: { 50 const eventsPerVideoPerPod: {
51 [ podId: string ]: { 51 [ podId: string ]: {
52 [ videoRemoteId: string ]: { 52 [ videoUUID: string ]: {
53 views?: number 53 views?: number
54 likes?: number 54 likes?: number
55 dislikes?: number 55 dislikes?: number
@@ -74,10 +74,10 @@ class RequestVideoEventScheduler extends AbstractRequestScheduler<RequestsVideoE
74 requestsToMakeGrouped[toPodId].ids.push(eventToProcess.id) 74 requestsToMakeGrouped[toPodId].ids.push(eventToProcess.id)
75 75
76 const eventsPerVideo = eventsPerVideoPerPod[toPodId] 76 const eventsPerVideo = eventsPerVideoPerPod[toPodId]
77 const remoteId = eventToProcess.video.remoteId 77 const uuid = eventToProcess.video.uuid
78 if (!eventsPerVideo[remoteId]) eventsPerVideo[remoteId] = {} 78 if (!eventsPerVideo[uuid]) eventsPerVideo[uuid] = {}
79 79
80 const events = eventsPerVideo[remoteId] 80 const events = eventsPerVideo[uuid]
81 if (!events[eventToProcess.type]) events[eventToProcess.type] = 0 81 if (!events[eventToProcess.type]) events[eventToProcess.type] = 0
82 82
83 events[eventToProcess.type] += eventToProcess.count 83 events[eventToProcess.type] += eventToProcess.count
@@ -88,13 +88,13 @@ class RequestVideoEventScheduler extends AbstractRequestScheduler<RequestsVideoE
88 Object.keys(eventsPerVideoPerPod).forEach(toPodId => { 88 Object.keys(eventsPerVideoPerPod).forEach(toPodId => {
89 const eventsForPod = eventsPerVideoPerPod[toPodId] 89 const eventsForPod = eventsPerVideoPerPod[toPodId]
90 90
91 Object.keys(eventsForPod).forEach(remoteId => { 91 Object.keys(eventsForPod).forEach(uuid => {
92 const eventsForVideo = eventsForPod[remoteId] 92 const eventsForVideo = eventsForPod[uuid]
93 93
94 Object.keys(eventsForVideo).forEach(eventType => { 94 Object.keys(eventsForVideo).forEach(eventType => {
95 requestsToMakeGrouped[toPodId].datas.push({ 95 requestsToMakeGrouped[toPodId].datas.push({
96 data: { 96 data: {
97 remoteId, 97 uuid,
98 eventType: eventType as RemoteVideoEventType, 98 eventType: eventType as RemoteVideoEventType,
99 count: +eventsForVideo[eventType] 99 count: +eventsForVideo[eventType]
100 } 100 }
diff --git a/server/lib/request/request-video-qadu-scheduler.ts b/server/lib/request/request-video-qadu-scheduler.ts
index 988165170..afb9d5c23 100644
--- a/server/lib/request/request-video-qadu-scheduler.ts
+++ b/server/lib/request/request-video-qadu-scheduler.ts
@@ -21,8 +21,8 @@ interface RequestsObjectsCustom<U> extends RequestsObjects<U> {
21 datas: U[] 21 datas: U[]
22 22
23 videos: { 23 videos: {
24 [ id: string ]: { 24 [ uuid: string ]: {
25 remoteId: string 25 uuid: string
26 likes?: number 26 likes?: number
27 dislikes?: number 27 dislikes?: number
28 views?: number 28 views?: number
@@ -33,7 +33,7 @@ interface RequestsObjectsCustom<U> extends RequestsObjects<U> {
33 33
34export type RequestVideoQaduSchedulerOptions = { 34export type RequestVideoQaduSchedulerOptions = {
35 type: RequestVideoQaduType 35 type: RequestVideoQaduType
36 videoId: string 36 videoId: number
37 transaction?: Sequelize.Transaction 37 transaction?: Sequelize.Transaction
38} 38}
39 39
@@ -78,7 +78,7 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa
78 78
79 // Maybe another attribute was filled for this video 79 // Maybe another attribute was filled for this video
80 let videoData = requestsToMakeGrouped[hashKey].videos[video.id] 80 let videoData = requestsToMakeGrouped[hashKey].videos[video.id]
81 if (!videoData) videoData = { remoteId: null } 81 if (!videoData) videoData = { uuid: null }
82 82
83 switch (request.type) { 83 switch (request.type) {
84 case REQUEST_VIDEO_QADU_TYPES.LIKES: 84 case REQUEST_VIDEO_QADU_TYPES.LIKES:
@@ -98,8 +98,8 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa
98 return 98 return
99 } 99 }
100 100
101 // Do not forget the remoteId so the remote pod can identify the video 101 // Do not forget the uuid so the remote pod can identify the video
102 videoData.remoteId = video.id 102 videoData.uuid = video.uuid
103 requestsToMakeGrouped[hashKey].ids.push(request.id) 103 requestsToMakeGrouped[hashKey].ids.push(request.id)
104 104
105 // Maybe there are multiple quick and dirty update for the same video 105 // Maybe there are multiple quick and dirty update for the same video
@@ -110,8 +110,8 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa
110 110
111 // Now we deduped similar quick and dirty updates, we can build our requests datas 111 // Now we deduped similar quick and dirty updates, we can build our requests datas
112 Object.keys(requestsToMakeGrouped).forEach(hashKey => { 112 Object.keys(requestsToMakeGrouped).forEach(hashKey => {
113 Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoId => { 113 Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoUUID => {
114 const videoData = requestsToMakeGrouped[hashKey].videos[videoId] 114 const videoData = requestsToMakeGrouped[hashKey].videos[videoUUID]
115 115
116 requestsToMakeGrouped[hashKey].datas.push({ 116 requestsToMakeGrouped[hashKey].datas.push({
117 data: videoData 117 data: videoData