X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fjob-queue%2Fhandlers%2Fvideo-views.ts;h=2258cd02989304c3216d094939e3528ee4622767;hb=a3b7421abb4192e215aa280418b62e96958c5e42;hp=73fa5ed041df8f937f67c572f3b97f6f1b0f3883;hpb=21d141c296541f41e399ec68aa7fa85e53d0dcb8;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/job-queue/handlers/video-views.ts b/server/lib/job-queue/handlers/video-views.ts index 73fa5ed04..2258cd029 100644 --- a/server/lib/job-queue/handlers/video-views.ts +++ b/server/lib/job-queue/handlers/video-views.ts @@ -23,6 +23,8 @@ async function processVideosViews () { for (const videoId of videoIds) { try { const views = await Redis.Instance.getVideoViews(videoId, hour) + await Redis.Instance.deleteVideoViews(videoId, hour) + if (views) { logger.debug('Adding %d views to video %d in hour %d.', views, videoId, hour) @@ -52,8 +54,6 @@ async function processVideosViews () { logger.error('Cannot create video views for video %d in hour %d.', videoId, hour, { err }) } } - - await Redis.Instance.deleteVideoViews(videoId, hour) } catch (err) { logger.error('Cannot update video views of video %d in hour %d.', videoId, hour, { err }) }