diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/constants.ts | 15 | ||||
-rw-r--r-- | server/initializers/database.ts | 4 |
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' | |||
8 | import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' | 8 | import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' |
9 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | 9 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' |
10 | import { invert } from 'lodash' | 10 | import { invert } from 'lodash' |
11 | import { RemoveOldJobsScheduler } from '../lib/schedulers/remove-old-jobs-scheduler' | ||
12 | import { 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 |
13 | let config: IConfig = require('config') | 15 | let config: IConfig = require('config') |
@@ -94,7 +96,11 @@ const JOB_REQUEST_TTL = 60000 * 10 // 10 minutes | |||
94 | const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days | 96 | const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days |
95 | 97 | ||
96 | // 1 hour | 98 | // 1 hour |
97 | let SCHEDULER_INTERVAL = 60000 * 60 | 99 | let 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' | |||
22 | import { VideoShareModel } from '../models/video/video-share' | 22 | import { VideoShareModel } from '../models/video/video-share' |
23 | import { VideoTagModel } from '../models/video/video-tag' | 23 | import { VideoTagModel } from '../models/video/video-tag' |
24 | import { CONFIG } from './constants' | 24 | import { CONFIG } from './constants' |
25 | import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update' | ||
25 | 26 | ||
26 | require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string | 27 | require('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) |