aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/request/request-video-event-scheduler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/request/request-video-event-scheduler.ts')
-rw-r--r--server/lib/request/request-video-event-scheduler.ts16
1 files changed, 8 insertions, 8 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 }