diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-05-02 22:02:27 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-05-04 21:12:32 +0200 |
commit | 227d02feadbc9b1fc916a12528ccc0623fb3069e (patch) | |
tree | 0b6bcc8c2c081591588714bc040ac6e810e333de /server/initializers | |
parent | 15d4ee04a94230e1ea83c2959a1981105699ba22 (diff) | |
download | PeerTube-227d02feadbc9b1fc916a12528ccc0623fb3069e.tar.gz PeerTube-227d02feadbc9b1fc916a12528ccc0623fb3069e.tar.zst PeerTube-227d02feadbc9b1fc916a12528ccc0623fb3069e.zip |
Server: add job scheduler to transcode video files
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/checker.js | 2 | ||||
-rw-r--r-- | server/initializers/constants.js | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/server/initializers/checker.js b/server/initializers/checker.js index 461a851fe..a3727563a 100644 --- a/server/initializers/checker.js +++ b/server/initializers/checker.js | |||
@@ -29,7 +29,7 @@ function checkMissedConfig () { | |||
29 | 'webserver.https', 'webserver.hostname', 'webserver.port', | 29 | 'webserver.https', 'webserver.hostname', 'webserver.port', |
30 | 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', | 30 | 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', |
31 | 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews', | 31 | 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews', |
32 | 'admin.email', 'signup.enabled' | 32 | 'admin.email', 'signup.enabled', 'transcoding.enabled', 'transcoding.threads' |
33 | ] | 33 | ] |
34 | const miss = [] | 34 | const miss = [] |
35 | 35 | ||
diff --git a/server/initializers/constants.js b/server/initializers/constants.js index d6da20982..87e9c8002 100644 --- a/server/initializers/constants.js +++ b/server/initializers/constants.js | |||
@@ -64,6 +64,10 @@ const CONFIG = { | |||
64 | }, | 64 | }, |
65 | SIGNUP: { | 65 | SIGNUP: { |
66 | ENABLED: config.get('signup.enabled') | 66 | ENABLED: config.get('signup.enabled') |
67 | }, | ||
68 | TRANSCODING: { | ||
69 | ENABLED: config.get('transcoding.enabled'), | ||
70 | THREADS: config.get('transcoding.threads') | ||
67 | } | 71 | } |
68 | } | 72 | } |
69 | CONFIG.WEBSERVER.URL = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT | 73 | CONFIG.WEBSERVER.URL = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT |
@@ -223,6 +227,18 @@ const REMOTE_SCHEME = { | |||
223 | WS: 'wss' | 227 | WS: 'wss' |
224 | } | 228 | } |
225 | 229 | ||
230 | const JOB_STATES = { | ||
231 | PENDING: 'pending', | ||
232 | PROCESSING: 'processing', | ||
233 | ERROR: 'error', | ||
234 | SUCCESS: 'success' | ||
235 | } | ||
236 | // How many maximum jobs we fetch from the database per cycle | ||
237 | const JOBS_FETCH_LIMIT_PER_CYCLE = 10 | ||
238 | const JOBS_CONCURRENCY = 1 | ||
239 | // 1 minutes | ||
240 | let JOBS_FETCHING_INTERVAL = 60000 | ||
241 | |||
226 | // --------------------------------------------------------------------------- | 242 | // --------------------------------------------------------------------------- |
227 | 243 | ||
228 | const PRIVATE_CERT_NAME = 'peertube.key.pem' | 244 | const PRIVATE_CERT_NAME = 'peertube.key.pem' |
@@ -264,6 +280,7 @@ if (isTestInstance() === true) { | |||
264 | CONSTRAINTS_FIELDS.VIDEOS.DURATION.max = 14 | 280 | CONSTRAINTS_FIELDS.VIDEOS.DURATION.max = 14 |
265 | FRIEND_SCORE.BASE = 20 | 281 | FRIEND_SCORE.BASE = 20 |
266 | REQUESTS_INTERVAL = 10000 | 282 | REQUESTS_INTERVAL = 10000 |
283 | JOBS_FETCHING_INTERVAL = 10000 | ||
267 | REMOTE_SCHEME.HTTP = 'http' | 284 | REMOTE_SCHEME.HTTP = 'http' |
268 | REMOTE_SCHEME.WS = 'ws' | 285 | REMOTE_SCHEME.WS = 'ws' |
269 | STATIC_MAX_AGE = 0 | 286 | STATIC_MAX_AGE = 0 |
@@ -277,6 +294,10 @@ module.exports = { | |||
277 | CONFIG, | 294 | CONFIG, |
278 | CONSTRAINTS_FIELDS, | 295 | CONSTRAINTS_FIELDS, |
279 | FRIEND_SCORE, | 296 | FRIEND_SCORE, |
297 | JOBS_FETCHING_INTERVAL, | ||
298 | JOB_STATES, | ||
299 | JOBS_CONCURRENCY, | ||
300 | JOBS_FETCH_LIMIT_PER_CYCLE, | ||
280 | LAST_MIGRATION_VERSION, | 301 | LAST_MIGRATION_VERSION, |
281 | OAUTH_LIFETIME, | 302 | OAUTH_LIFETIME, |
282 | PAGINATION_COUNT_DEFAULT, | 303 | PAGINATION_COUNT_DEFAULT, |