aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/config.ts11
-rw-r--r--server/initializers/constants.ts9
2 files changed, 13 insertions, 7 deletions
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 8dd62cba8..1f374dea9 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -2,7 +2,7 @@ import { IConfig } from 'config'
2import { dirname, join } from 'path' 2import { dirname, join } from 'path'
3import { VideosRedundancy } from '../../shared/models' 3import { VideosRedundancy } from '../../shared/models'
4// Do not use barrels, remain constants as independent as possible 4// Do not use barrels, remain constants as independent as possible
5import { buildPath, parseBytes, parseDuration, root } from '../helpers/core-utils' 5import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils'
6import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' 6import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
7import * as bytes from 'bytes' 7import * as bytes from 'bytes'
8 8
@@ -80,7 +80,7 @@ const CONFIG = {
80 }, 80 },
81 REDUNDANCY: { 81 REDUNDANCY: {
82 VIDEOS: { 82 VIDEOS: {
83 CHECK_INTERVAL: parseDuration(config.get<string>('redundancy.videos.check_interval')), 83 CHECK_INTERVAL: parseDurationToMs(config.get<string>('redundancy.videos.check_interval')),
84 STRATEGIES: buildVideosRedundancy(config.get<any[]>('redundancy.videos.strategies')) 84 STRATEGIES: buildVideosRedundancy(config.get<any[]>('redundancy.videos.strategies'))
85 } 85 }
86 }, 86 },
@@ -94,6 +94,11 @@ const CONFIG = {
94 PRIVATE: config.get<boolean>('tracker.private'), 94 PRIVATE: config.get<boolean>('tracker.private'),
95 REJECT_TOO_MANY_ANNOUNCES: config.get<boolean>('tracker.reject_too_many_announces') 95 REJECT_TOO_MANY_ANNOUNCES: config.get<boolean>('tracker.reject_too_many_announces')
96 }, 96 },
97 HISTORY: {
98 VIDEOS: {
99 MAX_AGE: parseDurationToMs(config.get('history.videos.max_age'))
100 }
101 },
97 ADMIN: { 102 ADMIN: {
98 get EMAIL () { return config.get<string>('admin.email') } 103 get EMAIL () { return config.get<string>('admin.email') }
99 }, 104 },
@@ -216,7 +221,7 @@ function buildVideosRedundancy (objs: any[]): VideosRedundancy[] {
216 221
217 return objs.map(obj => { 222 return objs.map(obj => {
218 return Object.assign({}, obj, { 223 return Object.assign({}, obj, {
219 minLifetime: parseDuration(obj.min_lifetime), 224 minLifetime: parseDurationToMs(obj.min_lifetime),
220 size: bytes.parse(obj.size), 225 size: bytes.parse(obj.size),
221 minViews: obj.min_views 226 minViews: obj.min_views
222 }) 227 })
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index a0609d7cd..f008cd291 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -158,12 +158,12 @@ const JOB_REQUEST_TIMEOUT = 3000 // 3 seconds
158const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days 158const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days
159const VIDEO_IMPORT_TIMEOUT = 1000 * 3600 // 1 hour 159const VIDEO_IMPORT_TIMEOUT = 1000 * 3600 // 1 hour
160 160
161// 1 hour 161const SCHEDULER_INTERVALS_MS = {
162let SCHEDULER_INTERVALS_MS = {
163 actorFollowScores: 60000 * 60, // 1 hour 162 actorFollowScores: 60000 * 60, // 1 hour
164 removeOldJobs: 60000 * 60, // 1 hour 163 removeOldJobs: 60000 * 60, // 1 hour
165 updateVideos: 60000, // 1 minute 164 updateVideos: 60000, // 1 minute
166 youtubeDLUpdate: 60000 * 60 * 24 // 1 day 165 youtubeDLUpdate: 60000 * 60 * 24, // 1 day
166 removeOldHistory: 60000 * 60 * 24 // 1 day
167} 167}
168 168
169// --------------------------------------------------------------------------- 169// ---------------------------------------------------------------------------
@@ -591,6 +591,7 @@ if (isTestInstance() === true) {
591 591
592 SCHEDULER_INTERVALS_MS.actorFollowScores = 1000 592 SCHEDULER_INTERVALS_MS.actorFollowScores = 1000
593 SCHEDULER_INTERVALS_MS.removeOldJobs = 10000 593 SCHEDULER_INTERVALS_MS.removeOldJobs = 10000
594 SCHEDULER_INTERVALS_MS.removeOldHistory = 5000
594 SCHEDULER_INTERVALS_MS.updateVideos = 5000 595 SCHEDULER_INTERVALS_MS.updateVideos = 5000
595 REPEAT_JOBS[ 'videos-views' ] = { every: 5000 } 596 REPEAT_JOBS[ 'videos-views' ] = { every: 5000 }
596 597
@@ -734,7 +735,7 @@ function buildVideosExtname () {
734} 735}
735 736
736function loadLanguages () { 737function loadLanguages () {
737 VIDEO_LANGUAGES = buildLanguages() 738 Object.assign(VIDEO_LANGUAGES, buildLanguages())
738} 739}
739 740
740function buildLanguages () { 741function buildLanguages () {