import { Transaction } from 'sequelize/types'
import { resetSequelizeInstance } from '@server/helpers/database-utils'
-import { logger } from '@server/helpers/logger'
+import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger'
import { sequelizeTypescript } from '@server/initializers/database'
import { Notifier } from '@server/lib/notifier'
import { PeerTubeSocket } from '@server/lib/peertube-socket'
private readonly oldVideoChannel: MChannelAccountLight
+ protected lTags: LoggerTagsFn
+
constructor (
protected readonly videoObject: VideoObject,
private readonly video: MVideoAccountLightBlacklistAllFiles
this.oldVideoChannel = this.video.VideoChannel
this.videoFieldsSave = this.video.toJSON()
+
+ this.lTags = loggerTagsFactory('ap', 'video', 'update', video.uuid, video.url)
}
async update (overrideTo?: string[]) {
- logger.debug('Updating remote video "%s".', this.videoObject.uuid, { videoObject: this.videoObject })
+ logger.debug(
+ 'Updating remote video "%s".', this.videoObject.uuid,
+ { videoObject: this.videoObject, ...this.lTags() }
+ )
try {
const channelActor = await this.getOrCreateVideoChannelFromVideoObject()
PeerTubeSocket.Instance.sendVideoViewsUpdate(videoUpdated)
}
- logger.info('Remote video with uuid %s updated', this.videoObject.uuid)
+ logger.info('Remote video with uuid %s updated', this.videoObject.uuid, this.lTags())
return videoUpdated
} catch (err) {
this.video.views = videoData.views
this.video.isLive = videoData.isLive
- // Ensures we update the updated video attribute
+ // Ensures we update the updatedAt attribute, even if main attributes did not change
this.video.changed('updatedAt', true)
return this.video.save({ transaction }) as Promise<MVideoFullLight>
}
// This is just a debug because we will retry the insert
- logger.debug('Cannot update the remote video.', { err })
+ logger.debug('Cannot update the remote video.', { err, ...this.lTags() })
throw err
}
}