aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-25 15:05:18 +0100
committerChocobozzz <me@florianbigard.com>2018-01-25 18:41:17 +0100
commit94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4 (patch)
tree32a9148e0e4567f0c4ffae0412cbed20b84e8873 /server/helpers
parentd765fafc3faf0db9818eb1a07161df1cb1bc0efa (diff)
downloadPeerTube-94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4.tar.gz
PeerTube-94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4.tar.zst
PeerTube-94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4.zip
Move job queue to redis
We'll use it as cache in the future. /!\ You'll loose your old jobs (pending jobs too) so upgrade only when you don't have pending job anymore.
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/custom-validators/jobs.ts14
-rw-r--r--server/helpers/database-utils.ts1
2 files changed, 15 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/jobs.ts b/server/helpers/custom-validators/jobs.ts
new file mode 100644
index 000000000..9700fbd12
--- /dev/null
+++ b/server/helpers/custom-validators/jobs.ts
@@ -0,0 +1,14 @@
1import { JobState } from '../../../shared/models'
2import { exists } from './misc'
3
4const jobStates: JobState[] = [ 'active', 'complete', 'failed', 'inactive', 'delayed' ]
5
6function isValidJobState (value: JobState) {
7 return exists(value) && jobStates.indexOf(value) !== -1
8}
9
10// ---------------------------------------------------------------------------
11
12export {
13 isValidJobState
14}
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts
index 78ca768b9..b4adaf9cc 100644
--- a/server/helpers/database-utils.ts
+++ b/server/helpers/database-utils.ts
@@ -16,6 +16,7 @@ function retryTransactionWrapper <T> (
16 .catch(err => callback(err)) 16 .catch(err => callback(err))
17 }) 17 })
18 .catch(err => { 18 .catch(err => {
19 console.error(err)
19 logger.error(options.errorMessage, err) 20 logger.error(options.errorMessage, err)
20 throw err 21 throw err
21 }) 22 })