-function createTorrentFederate (video: MVideoFullLight, videoFile: MVideoFile) {
- // Create the torrent file in async way because it could be long
- return createTorrentAndSetInfoHashAsync(video, videoFile)
- .catch(err => logger.error('Cannot create torrent file for video %s', video.url, { err, ...lTags(video.uuid) }))
- .then(() => VideoModel.loadAndPopulateAccountAndServerAndTags(video.id))
- .then(refreshedVideo => {
- if (!refreshedVideo) return
+ // Only federate and notify after the torrent creation
+ Notifier.Instance.notifyOnNewVideoIfNeeded(refreshedVideo)