Reduce error logs

pull/5004/head
Chocobozzz 2022-05-18 12:01:02 +02:00
parent efa236c6c6
commit 941d28cc7f
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 8 additions and 1 deletions

View File

@ -106,6 +106,8 @@ const jobTypes: JobType[] = [
'video-studio-edition' 'video-studio-edition'
] ]
const silentFailure = new Set<JobType>([ 'activitypub-http-unicast' ])
class JobQueue { class JobQueue {
private static instance: JobQueue private static instance: JobQueue
@ -152,7 +154,11 @@ class JobQueue {
.catch(err => logger.error('Error in job queue processor %s.', handlerName, { err })) .catch(err => logger.error('Error in job queue processor %s.', handlerName, { err }))
queue.on('failed', (job, err) => { queue.on('failed', (job, err) => {
logger.error('Cannot execute job %d in queue %s.', job.id, handlerName, { payload: job.data, err }) const logLevel = silentFailure.has(handlerName)
? 'debug'
: 'error'
logger.log(logLevel, 'Cannot execute job %d in queue %s.', job.id, handlerName, { payload: job.data, err })
}) })
queue.on('error', err => { queue.on('error', err => {

View File

@ -136,6 +136,7 @@ export class VideoViewerStats {
try { try {
await sequelizeTypescript.transaction(async t => { await sequelizeTypescript.transaction(async t => {
const video = await VideoModel.load(stats.videoId, t) const video = await VideoModel.load(stats.videoId, t)
if (!video) return
const statsModel = await this.saveViewerStats(video, stats, t) const statsModel = await this.saveViewerStats(video, stats, t)