diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-09 10:11:20 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-11-09 15:00:31 +0100 |
commit | 51353d9a035fb6b81f903a8b5f391292841649fd (patch) | |
tree | 75acb6eea5e043bf2e15a6a5a92e9a3c5967b156 /server/initializers/constants.ts | |
parent | 221ee1adc916684d4881d2a9c4c01954dcde986e (diff) | |
download | PeerTube-51353d9a035fb6b81f903a8b5f391292841649fd.tar.gz PeerTube-51353d9a035fb6b81f903a8b5f391292841649fd.tar.zst PeerTube-51353d9a035fb6b81f903a8b5f391292841649fd.zip |
Refactor video views
Introduce viewers attribute for live videos
Count views for live videos
Reduce delay to see the viewer update for lives
Add ability to configure video views buffer interval and view ip
expiration
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 845576667..b65741bbd 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -148,7 +148,7 @@ const JOB_ATTEMPTS: { [id in JobType]: number } = { | |||
148 | 'video-import': 1, | 148 | 'video-import': 1, |
149 | 'email': 5, | 149 | 'email': 5, |
150 | 'actor-keys': 3, | 150 | 'actor-keys': 3, |
151 | 'videos-views': 1, | 151 | 'videos-views-stats': 1, |
152 | 'activitypub-refresher': 1, | 152 | 'activitypub-refresher': 1, |
153 | 'video-redundancy': 1, | 153 | 'video-redundancy': 1, |
154 | 'video-live-ending': 1, | 154 | 'video-live-ending': 1, |
@@ -164,7 +164,7 @@ const JOB_CONCURRENCY: { [id in Exclude<JobType, 'video-transcoding' | 'video-im | |||
164 | 'video-file-import': 1, | 164 | 'video-file-import': 1, |
165 | 'email': 5, | 165 | 'email': 5, |
166 | 'actor-keys': 1, | 166 | 'actor-keys': 1, |
167 | 'videos-views': 1, | 167 | 'videos-views-stats': 1, |
168 | 'activitypub-refresher': 1, | 168 | 'activitypub-refresher': 1, |
169 | 'video-redundancy': 1, | 169 | 'video-redundancy': 1, |
170 | 'video-live-ending': 10, | 170 | 'video-live-ending': 10, |
@@ -181,14 +181,14 @@ const JOB_TTL: { [id in JobType]: number } = { | |||
181 | 'video-import': 1000 * 3600 * 2, // 2 hours | 181 | 'video-import': 1000 * 3600 * 2, // 2 hours |
182 | 'email': 60000 * 10, // 10 minutes | 182 | 'email': 60000 * 10, // 10 minutes |
183 | 'actor-keys': 60000 * 20, // 20 minutes | 183 | 'actor-keys': 60000 * 20, // 20 minutes |
184 | 'videos-views': undefined, // Unlimited | 184 | 'videos-views-stats': undefined, // Unlimited |
185 | 'activitypub-refresher': 60000 * 10, // 10 minutes | 185 | 'activitypub-refresher': 60000 * 10, // 10 minutes |
186 | 'video-redundancy': 1000 * 3600 * 3, // 3 hours | 186 | 'video-redundancy': 1000 * 3600 * 3, // 3 hours |
187 | 'video-live-ending': 1000 * 60 * 10, // 10 minutes | 187 | 'video-live-ending': 1000 * 60 * 10, // 10 minutes |
188 | 'move-to-object-storage': 1000 * 60 * 60 * 3 // 3 hours | 188 | 'move-to-object-storage': 1000 * 60 * 60 * 3 // 3 hours |
189 | } | 189 | } |
190 | const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = { | 190 | const REPEAT_JOBS: { [ id in JobType ]?: EveryRepeatOptions | CronRepeatOptions } = { |
191 | 'videos-views': { | 191 | 'videos-views-stats': { |
192 | cron: randomInt(1, 20) + ' * * * *' // Between 1-20 minutes past the hour | 192 | cron: randomInt(1, 20) + ' * * * *' // Between 1-20 minutes past the hour |
193 | }, | 193 | }, |
194 | 'activitypub-cleaner': { | 194 | 'activitypub-cleaner': { |
@@ -211,6 +211,7 @@ const SCHEDULER_INTERVALS_MS = { | |||
211 | REMOVE_OLD_JOBS: 60000 * 60, // 1 hour | 211 | REMOVE_OLD_JOBS: 60000 * 60, // 1 hour |
212 | UPDATE_VIDEOS: 60000, // 1 minute | 212 | UPDATE_VIDEOS: 60000, // 1 minute |
213 | YOUTUBE_DL_UPDATE: 60000 * 60 * 24, // 1 day | 213 | YOUTUBE_DL_UPDATE: 60000 * 60 * 24, // 1 day |
214 | VIDEO_VIEWS_BUFFER_UPDATE: CONFIG.VIEWS.VIDEOS.LOCAL_BUFFER_UPDATE_INTERVAL, | ||
214 | CHECK_PLUGINS: CONFIG.PLUGINS.INDEX.CHECK_LATEST_VERSIONS_INTERVAL, | 215 | CHECK_PLUGINS: CONFIG.PLUGINS.INDEX.CHECK_LATEST_VERSIONS_INTERVAL, |
215 | CHECK_PEERTUBE_VERSION: 60000 * 60 * 24, // 1 day | 216 | CHECK_PEERTUBE_VERSION: 60000 * 60 * 24, // 1 day |
216 | AUTO_FOLLOW_INDEX_INSTANCES: 60000 * 60 * 24, // 1 day | 217 | AUTO_FOLLOW_INDEX_INSTANCES: 60000 * 60 * 24, // 1 day |
@@ -343,8 +344,8 @@ const CONSTRAINTS_FIELDS = { | |||
343 | } | 344 | } |
344 | 345 | ||
345 | const VIEW_LIFETIME = { | 346 | const VIEW_LIFETIME = { |
346 | VIDEO: 60000 * 60, // 1 hour | 347 | VIEW: CONFIG.VIEWS.VIDEOS.IP_VIEW_EXPIRATION, |
347 | LIVE: 60000 * 5 // 5 minutes | 348 | VIEWER: 60000 * 5 // 5 minutes |
348 | } | 349 | } |
349 | 350 | ||
350 | let CONTACT_FORM_LIFETIME = 60000 * 60 // 1 hour | 351 | let CONTACT_FORM_LIFETIME = 60000 * 60 // 1 hour |
@@ -789,13 +790,12 @@ if (isTestInstance() === true) { | |||
789 | SCHEDULER_INTERVALS_MS.AUTO_FOLLOW_INDEX_INSTANCES = 5000 | 790 | SCHEDULER_INTERVALS_MS.AUTO_FOLLOW_INDEX_INSTANCES = 5000 |
790 | SCHEDULER_INTERVALS_MS.UPDATE_INBOX_STATS = 5000 | 791 | SCHEDULER_INTERVALS_MS.UPDATE_INBOX_STATS = 5000 |
791 | SCHEDULER_INTERVALS_MS.CHECK_PEERTUBE_VERSION = 2000 | 792 | SCHEDULER_INTERVALS_MS.CHECK_PEERTUBE_VERSION = 2000 |
792 | REPEAT_JOBS['videos-views'] = { every: 5000 } | 793 | REPEAT_JOBS['videos-views-stats'] = { every: 5000 } |
793 | REPEAT_JOBS['activitypub-cleaner'] = { every: 5000 } | 794 | REPEAT_JOBS['activitypub-cleaner'] = { every: 5000 } |
794 | 795 | ||
795 | REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 | 796 | REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 |
796 | 797 | ||
797 | VIEW_LIFETIME.VIDEO = 1000 // 1 second | 798 | VIEW_LIFETIME.VIEWER = 1000 * 5 // 5 second |
798 | VIEW_LIFETIME.LIVE = 1000 * 5 // 5 second | ||
799 | CONTACT_FORM_LIFETIME = 1000 // 1 second | 799 | CONTACT_FORM_LIFETIME = 1000 // 1 second |
800 | 800 | ||
801 | JOB_ATTEMPTS['email'] = 1 | 801 | JOB_ATTEMPTS['email'] = 1 |