diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-25 15:05:18 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-25 18:41:17 +0100 |
commit | 94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4 (patch) | |
tree | 32a9148e0e4567f0c4ffae0412cbed20b84e8873 /scripts | |
parent | d765fafc3faf0db9818eb1a07161df1cb1bc0efa (diff) | |
download | PeerTube-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 'scripts')
-rwxr-xr-x | scripts/clean/server/test.sh | 1 | ||||
-rwxr-xr-x | scripts/parse-log.ts | 22 |
2 files changed, 21 insertions, 2 deletions
diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh index 2ceb71244..b56021874 100755 --- a/scripts/clean/server/test.sh +++ b/scripts/clean/server/test.sh | |||
@@ -6,4 +6,5 @@ for i in $(seq 1 6); do | |||
6 | rm -f "./config/local-test.json" | 6 | rm -f "./config/local-test.json" |
7 | rm -f "./config/local-test-$i.json" | 7 | rm -f "./config/local-test-$i.json" |
8 | createdb "peertube_test$i" | 8 | createdb "peertube_test$i" |
9 | redis-cli KEYS "q-localhost:900$i*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL | ||
9 | done | 10 | done |
diff --git a/scripts/parse-log.ts b/scripts/parse-log.ts index 7e804b3f9..9429512b7 100755 --- a/scripts/parse-log.ts +++ b/scripts/parse-log.ts | |||
@@ -2,16 +2,34 @@ import { createReadStream } from 'fs' | |||
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | import { createInterface } from 'readline' | 3 | import { createInterface } from 'readline' |
4 | import * as winston from 'winston' | 4 | import * as winston from 'winston' |
5 | import { labelFormatter, loggerFormat, timestampFormatter } from '../server/helpers/logger' | 5 | import { labelFormatter } from '../server/helpers/logger' |
6 | import { CONFIG } from '../server/initializers/constants' | 6 | import { CONFIG } from '../server/initializers/constants' |
7 | 7 | ||
8 | const excludedKeys = { | ||
9 | level: true, | ||
10 | message: true, | ||
11 | splat: true, | ||
12 | timestamp: true, | ||
13 | label: true | ||
14 | } | ||
15 | function keysExcluder (key, value) { | ||
16 | return excludedKeys[key] === true ? undefined : value | ||
17 | } | ||
18 | |||
19 | const loggerFormat = winston.format.printf((info) => { | ||
20 | let additionalInfos = JSON.stringify(info, keysExcluder, 2) | ||
21 | if (additionalInfos === '{}') additionalInfos = '' | ||
22 | else additionalInfos = ' ' + additionalInfos | ||
23 | |||
24 | return `[${info.label}] ${new Date(info.timestamp).toISOString()} ${info.level}: ${info.message}${additionalInfos}` | ||
25 | }) | ||
26 | |||
8 | const logger = new winston.createLogger({ | 27 | const logger = new winston.createLogger({ |
9 | transports: [ | 28 | transports: [ |
10 | new winston.transports.Console({ | 29 | new winston.transports.Console({ |
11 | level: 'debug', | 30 | level: 'debug', |
12 | stderrLevels: [], | 31 | stderrLevels: [], |
13 | format: winston.format.combine( | 32 | format: winston.format.combine( |
14 | timestampFormatter, | ||
15 | winston.format.splat(), | 33 | winston.format.splat(), |
16 | labelFormatter, | 34 | labelFormatter, |
17 | winston.format.colorize(), | 35 | winston.format.colorize(), |