aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts15
-rw-r--r--server/initializers/database.ts4
2 files changed, 15 insertions, 4 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 65f89ff7f..164378505 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -8,6 +8,8 @@ import { VideoPrivacy } from '../../shared/models/videos'
8import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' 8import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
9import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' 9import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
10import { invert } from 'lodash' 10import { invert } from 'lodash'
11import { RemoveOldJobsScheduler } from '../lib/schedulers/remove-old-jobs-scheduler'
12import { UpdateVideosScheduler } from '../lib/schedulers/update-videos-scheduler'
11 13
12// Use a variable to reload the configuration if we need 14// Use a variable to reload the configuration if we need
13let config: IConfig = require('config') 15let config: IConfig = require('config')
@@ -94,7 +96,11 @@ const JOB_REQUEST_TTL = 60000 * 10 // 10 minutes
94const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days 96const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days
95 97
96// 1 hour 98// 1 hour
97let SCHEDULER_INTERVAL = 60000 * 60 99let SCHEDULER_INTERVALS_MS = {
100 badActorFollow: 60000 * 60, // 1 hour
101 removeOldJobs: 60000 * 60, // 1 jour
102 updateVideos: 60000 * 1, // 1 minute
103}
98 104
99// --------------------------------------------------------------------------- 105// ---------------------------------------------------------------------------
100 106
@@ -460,7 +466,10 @@ if (isTestInstance() === true) {
460 466
461 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB 467 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB
462 468
463 SCHEDULER_INTERVAL = 10000 469 SCHEDULER_INTERVALS_MS.badActorFollow = 10000
470 SCHEDULER_INTERVALS_MS.removeOldJobs = 10000
471 SCHEDULER_INTERVALS_MS.updateVideos = 5000
472
464 VIDEO_VIEW_LIFETIME = 1000 // 1 second 473 VIDEO_VIEW_LIFETIME = 1000 // 1 second
465 474
466 JOB_ATTEMPTS['email'] = 1 475 JOB_ATTEMPTS['email'] = 1
@@ -513,7 +522,7 @@ export {
513 JOB_REQUEST_TTL, 522 JOB_REQUEST_TTL,
514 USER_PASSWORD_RESET_LIFETIME, 523 USER_PASSWORD_RESET_LIFETIME,
515 IMAGE_MIMETYPE_EXT, 524 IMAGE_MIMETYPE_EXT,
516 SCHEDULER_INTERVAL, 525 SCHEDULER_INTERVALS_MS,
517 STATIC_DOWNLOAD_PATHS, 526 STATIC_DOWNLOAD_PATHS,
518 RATES_LIMIT, 527 RATES_LIMIT,
519 VIDEO_EXT_MIMETYPE, 528 VIDEO_EXT_MIMETYPE,
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index b537ee59a..4d90c90fc 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -22,6 +22,7 @@ import { VideoFileModel } from '../models/video/video-file'
22import { VideoShareModel } from '../models/video/video-share' 22import { VideoShareModel } from '../models/video/video-share'
23import { VideoTagModel } from '../models/video/video-tag' 23import { VideoTagModel } from '../models/video/video-tag'
24import { CONFIG } from './constants' 24import { CONFIG } from './constants'
25import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update'
25 26
26require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string 27require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string
27 28
@@ -73,7 +74,8 @@ async function initDatabaseModels (silent: boolean) {
73 VideoBlacklistModel, 74 VideoBlacklistModel,
74 VideoTagModel, 75 VideoTagModel,
75 VideoModel, 76 VideoModel,
76 VideoCommentModel 77 VideoCommentModel,
78 ScheduleVideoUpdateModel
77 ]) 79 ])
78 80
79 if (!silent) logger.info('Database %s is ready.', dbname) 81 if (!silent) logger.info('Database %s is ready.', dbname)