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.
This commit is contained in:
parent
d765fafc3f
commit
94a5ff8a4a
60 changed files with 992 additions and 703 deletions
|
@ -2,16 +2,34 @@ import { createReadStream } from 'fs'
|
|||
import { join } from 'path'
|
||||
import { createInterface } from 'readline'
|
||||
import * as winston from 'winston'
|
||||
import { labelFormatter, loggerFormat, timestampFormatter } from '../server/helpers/logger'
|
||||
import { labelFormatter } from '../server/helpers/logger'
|
||||
import { CONFIG } from '../server/initializers/constants'
|
||||
|
||||
const excludedKeys = {
|
||||
level: true,
|
||||
message: true,
|
||||
splat: true,
|
||||
timestamp: true,
|
||||
label: true
|
||||
}
|
||||
function keysExcluder (key, value) {
|
||||
return excludedKeys[key] === true ? undefined : value
|
||||
}
|
||||
|
||||
const loggerFormat = winston.format.printf((info) => {
|
||||
let additionalInfos = JSON.stringify(info, keysExcluder, 2)
|
||||
if (additionalInfos === '{}') additionalInfos = ''
|
||||
else additionalInfos = ' ' + additionalInfos
|
||||
|
||||
return `[${info.label}] ${new Date(info.timestamp).toISOString()} ${info.level}: ${info.message}${additionalInfos}`
|
||||
})
|
||||
|
||||
const logger = new winston.createLogger({
|
||||
transports: [
|
||||
new winston.transports.Console({
|
||||
level: 'debug',
|
||||
stderrLevels: [],
|
||||
format: winston.format.combine(
|
||||
timestampFormatter,
|
||||
winston.format.splat(),
|
||||
labelFormatter,
|
||||
winston.format.colorize(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue