X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fconstants.ts;h=f66e6b65d5ffaf120e57a2b2315631817cdbec0b;hb=f7298d0dcc247fe3be94ec1e00351942a079a44b;hp=b65741bbd29457de648a082c64e812245b77f4c9;hpb=51353d9a035fb6b81f903a8b5f391292841649fd;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index b65741bbd..f66e6b65d 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -2,7 +2,7 @@ import { CronRepeatOptions, EveryRepeatOptions } from 'bull' import { randomBytes } from 'crypto' import { invert } from 'lodash' import { join } from 'path' -import { randomInt } from '../../shared/core-utils/common/miscs' +import { randomInt, root } from '@shared/core-utils' import { AbuseState, JobType, @@ -19,12 +19,12 @@ import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model' import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model' // Do not use barrels, remain constants as independent as possible -import { isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' +import { isTestInstance, parseDurationToMs, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' import { CONFIG, registerConfigChangedHandler } from './config' // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 670 +const LAST_MIGRATION_VERSION = 675 // --------------------------------------------------------------------------- @@ -200,11 +200,22 @@ const JOB_PRIORITY = { } const BROADCAST_CONCURRENCY = 30 // How many requests in parallel we do in activitypub-http-broadcast job -const AP_CLEANER_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-cleaner job const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch remote data (likes, shares...) -const REQUEST_TIMEOUT = 7000 // 7 seconds + +const AP_CLEANER = { + CONCURRENCY: 10, // How many requests in parallel we do in activitypub-cleaner job + UNAVAILABLE_TRESHOLD: 3, // How many attemps we do before removing an unavailable remote resource + PERIOD: parseDurationToMs('1 week') // /!\ Has to be sync with REPEAT_JOBS +} + +const REQUEST_TIMEOUTS = { + DEFAULT: 7000, // 7 seconds + FILE: 30000, // 30 seconds + REDUNDANCY: JOB_TTL['video-redundancy'] +} + const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days -const VIDEO_IMPORT_TIMEOUT = 1000 * 3600 // 1 hour +const VIDEO_IMPORT_TIMEOUT = Math.floor(JOB_TTL['video-import'] * 0.9) const SCHEDULER_INTERVALS_MS = { ACTOR_FOLLOW_SCORES: 60000 * 60, // 1 hour @@ -218,7 +229,7 @@ const SCHEDULER_INTERVALS_MS = { REMOVE_OLD_VIEWS: 60000 * 60 * 24, // 1 day REMOVE_OLD_HISTORY: 60000 * 60 * 24, // 1 day UPDATE_INBOX_STATS: 1000 * 60, // 1 minute - REMOVE_DANGLING_RESUMABLE_UPLOADS: 60000 * 60 * 16 // 16 hours + REMOVE_DANGLING_RESUMABLE_UPLOADS: 60000 * 60 // 1 hour } // --------------------------------------------------------------------------- @@ -254,7 +265,7 @@ const CONSTRAINTS_FIELDS = { CAPTION_FILE: { EXTNAME: [ '.vtt', '.srt' ], FILE_SIZE: { - max: 4 * 1024 * 1024 // 4MB + max: 20 * 1024 * 1024 // 20MB } } }, @@ -422,14 +433,17 @@ const VIDEO_STATES: { [ id in VideoState ]: string } = { [VideoState.WAITING_FOR_LIVE]: 'Waiting for livestream', [VideoState.LIVE_ENDED]: 'Livestream ended', [VideoState.TO_MOVE_TO_EXTERNAL_STORAGE]: 'To move to an external storage', - [VideoState.TRANSCODING_FAILED]: 'Transcoding failed' + [VideoState.TRANSCODING_FAILED]: 'Transcoding failed', + [VideoState.TO_MOVE_TO_EXTERNAL_STORAGE_FAILED]: 'External storage move failed' } const VIDEO_IMPORT_STATES: { [ id in VideoImportState ]: string } = { [VideoImportState.FAILED]: 'Failed', [VideoImportState.PENDING]: 'Pending', [VideoImportState.SUCCESS]: 'Success', - [VideoImportState.REJECTED]: 'Rejected' + [VideoImportState.REJECTED]: 'Rejected', + [VideoImportState.CANCELLED]: 'Cancelled', + [VideoImportState.PROCESSING]: 'Processing' } const ABUSE_STATES: { [ id in AbuseState ]: string } = { @@ -790,8 +804,11 @@ if (isTestInstance() === true) { SCHEDULER_INTERVALS_MS.AUTO_FOLLOW_INDEX_INSTANCES = 5000 SCHEDULER_INTERVALS_MS.UPDATE_INBOX_STATS = 5000 SCHEDULER_INTERVALS_MS.CHECK_PEERTUBE_VERSION = 2000 + REPEAT_JOBS['videos-views-stats'] = { every: 5000 } + REPEAT_JOBS['activitypub-cleaner'] = { every: 5000 } + AP_CLEANER.PERIOD = 5000 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 @@ -852,7 +869,7 @@ export { REDUNDANCY, JOB_CONCURRENCY, JOB_ATTEMPTS, - AP_CLEANER_CONCURRENCY, + AP_CLEANER, LAST_MIGRATION_VERSION, OAUTH_LIFETIME, CUSTOM_HTML_TAG_COMMENTS, @@ -896,7 +913,7 @@ export { FFMPEG_NICE, ABUSE_STATES, LRU_CACHE, - REQUEST_TIMEOUT, + REQUEST_TIMEOUTS, USER_PASSWORD_RESET_LIFETIME, USER_PASSWORD_CREATE_LIFETIME, MEMOIZE_TTL, @@ -1070,7 +1087,9 @@ function buildLanguages () { epo: true, // Esperanto tlh: true, // Klingon jbo: true, // Lojban - avk: true // Kotava + avk: true, // Kotava + + zxx: true // No linguistic content (ISO-639-2) } // Only add ISO639-1 languages and some sign languages (ISO639-3) @@ -1085,6 +1104,10 @@ function buildLanguages () { languages['oc'] = 'Occitan' languages['el'] = 'Greek' + // Chinese languages + languages['zh-Hans'] = 'Simplified Chinese' + languages['zh-Hant'] = 'Traditional Chinese' + return languages }