aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-08 10:51:10 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-02-08 15:38:45 +0100
commit9129b7694d577322327ee79e9b9aa64deee92765 (patch)
treeeb23b7a952048c3725f29109d38c36368976dec0 /server/initializers
parent81b46cbc3417c46263c210c61b51a84a457abaaa (diff)
downloadPeerTube-9129b7694d577322327ee79e9b9aa64deee92765.tar.gz
PeerTube-9129b7694d577322327ee79e9b9aa64deee92765.tar.zst
PeerTube-9129b7694d577322327ee79e9b9aa64deee92765.zip
Allow to specify transcoding and import jobs concurrency
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/checker-after-init.ts10
-rw-r--r--server/initializers/checker-before-init.ts4
-rw-r--r--server/initializers/config.ts3
-rw-r--r--server/initializers/constants.ts4
4 files changed, 16 insertions, 5 deletions
diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts
index 979c97a8b..2b00e2047 100644
--- a/server/initializers/checker-after-init.ts
+++ b/server/initializers/checker-after-init.ts
@@ -116,6 +116,16 @@ function checkConfig () {
116 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false && CONFIG.TRANSCODING.HLS.ENABLED === false) { 116 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false && CONFIG.TRANSCODING.HLS.ENABLED === false) {
117 return 'You need to enable at least WebTorrent transcoding or HLS transcoding.' 117 return 'You need to enable at least WebTorrent transcoding or HLS transcoding.'
118 } 118 }
119
120 if (CONFIG.TRANSCODING.CONCURRENCY <= 0) {
121 return 'Transcoding concurrency should be > 0'
122 }
123 }
124
125 if (CONFIG.IMPORT.VIDEOS.HTTP.ENABLED || CONFIG.IMPORT.VIDEOS.TORRENT.ENABLED) {
126 if (CONFIG.IMPORT.VIDEOS.CONCURRENCY <= 0) {
127 return 'Video import concurrency should be > 0'
128 }
119 } 129 }
120 130
121 // Broadcast message 131 // Broadcast message
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts
index cac24f0b6..a186afbdd 100644
--- a/server/initializers/checker-before-init.ts
+++ b/server/initializers/checker-before-init.ts
@@ -22,10 +22,10 @@ function checkMissedConfig () {
22 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist', 22 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist',
23 'redundancy.videos.strategies', 'redundancy.videos.check_interval', 23 'redundancy.videos.strategies', 'redundancy.videos.check_interval',
24 'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions', 'transcoding.hls.enabled', 24 'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions', 'transcoding.hls.enabled',
25 'transcoding.profile', 25 'transcoding.profile', 'transcoding.concurrency',
26 'transcoding.resolutions.0p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p', 'transcoding.resolutions.480p', 26 'transcoding.resolutions.0p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p', 'transcoding.resolutions.480p',
27 'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', 'transcoding.resolutions.2160p', 27 'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', 'transcoding.resolutions.2160p',
28 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'auto_blacklist.videos.of_users.enabled', 28 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'auto_blacklist.videos.of_users.enabled',
29 'trending.videos.interval_days', 29 'trending.videos.interval_days',
30 'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route', 30 'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route',
31 'instance.is_nsfw', 'instance.default_nsfw_policy', 'instance.robots', 'instance.securitytxt', 31 'instance.is_nsfw', 'instance.default_nsfw_policy', 'instance.robots', 'instance.securitytxt',
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 3b44d82ed..930fd784e 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -188,6 +188,7 @@ const CONFIG = {
188 get ALLOW_ADDITIONAL_EXTENSIONS () { return config.get<boolean>('transcoding.allow_additional_extensions') }, 188 get ALLOW_ADDITIONAL_EXTENSIONS () { return config.get<boolean>('transcoding.allow_additional_extensions') },
189 get ALLOW_AUDIO_FILES () { return config.get<boolean>('transcoding.allow_audio_files') }, 189 get ALLOW_AUDIO_FILES () { return config.get<boolean>('transcoding.allow_audio_files') },
190 get THREADS () { return config.get<number>('transcoding.threads') }, 190 get THREADS () { return config.get<number>('transcoding.threads') },
191 get CONCURRENCY () { return config.get<number>('transcoding.concurrency') },
191 get PROFILE () { return config.get<string>('transcoding.profile') }, 192 get PROFILE () { return config.get<string>('transcoding.profile') },
192 RESOLUTIONS: { 193 RESOLUTIONS: {
193 get '0p' () { return config.get<boolean>('transcoding.resolutions.0p') }, 194 get '0p' () { return config.get<boolean>('transcoding.resolutions.0p') },
@@ -237,6 +238,8 @@ const CONFIG = {
237 }, 238 },
238 IMPORT: { 239 IMPORT: {
239 VIDEOS: { 240 VIDEOS: {
241 get CONCURRENCY () { return config.get<number>('import.videos.concurrency') },
242
240 HTTP: { 243 HTTP: {
241 get ENABLED () { return config.get<boolean>('import.videos.http.enabled') }, 244 get ENABLED () { return config.get<boolean>('import.videos.http.enabled') },
242 get FORCE_IPV4 () { return config.get<boolean>('import.videos.http.force_ipv4') }, 245 get FORCE_IPV4 () { return config.get<boolean>('import.videos.http.force_ipv4') },
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 9d9b3966c..7beaca238 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -146,14 +146,12 @@ const JOB_ATTEMPTS: { [id in JobType]: number } = {
146 'video-redundancy': 1, 146 'video-redundancy': 1,
147 'video-live-ending': 1 147 'video-live-ending': 1
148} 148}
149const JOB_CONCURRENCY: { [id in JobType]: number } = { 149const JOB_CONCURRENCY: { [id in JobType]?: number } = {
150 'activitypub-http-broadcast': 1, 150 'activitypub-http-broadcast': 1,
151 'activitypub-http-unicast': 5, 151 'activitypub-http-unicast': 5,
152 'activitypub-http-fetcher': 1, 152 'activitypub-http-fetcher': 1,
153 'activitypub-follow': 1, 153 'activitypub-follow': 1,
154 'video-file-import': 1, 154 'video-file-import': 1,
155 'video-transcoding': 1,
156 'video-import': 1,
157 'email': 5, 155 'email': 5,
158 'videos-views': 1, 156 'videos-views': 1,
159 'activitypub-refresher': 1, 157 'activitypub-refresher': 1,