From 02b286f89088e07cac7e7068e884d3be0fd0098b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 6 Sep 2021 09:29:25 +0200 Subject: More robust webtorrent redundancy download Avoid issues with inconsistencies between magnet infohash and torrent infohash, blocking webtorrent upload that will timeout --- server/lib/schedulers/videos-redundancy-scheduler.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'server/lib/schedulers/videos-redundancy-scheduler.ts') diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts index 633cbcf6c..155d43343 100644 --- a/server/lib/schedulers/videos-redundancy-scheduler.ts +++ b/server/lib/schedulers/videos-redundancy-scheduler.ts @@ -1,7 +1,6 @@ import { move } from 'fs-extra' import { join } from 'path' import { getServerActor } from '@server/models/application/application' -import { TrackerModel } from '@server/models/server/tracker' import { VideoModel } from '@server/models/video/video' import { MStreamingPlaylistFiles, @@ -15,7 +14,7 @@ import { } from '@server/types/models' import { VideosRedundancyStrategy } from '../../../shared/models/redundancy' import { logger, loggerTagsFactory } from '../../helpers/logger' -import { downloadWebTorrentVideo, generateMagnetUri } from '../../helpers/webtorrent' +import { downloadWebTorrentVideo } from '../../helpers/webtorrent' import { CONFIG } from '../../initializers/config' import { HLS_REDUNDANCY_DIRECTORY, REDUNDANCY, VIDEO_IMPORT_TIMEOUT } from '../../initializers/constants' import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' @@ -232,10 +231,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler { logger.info('Duplicating %s - %d in videos redundancy with "%s" strategy.', video.url, file.resolution, strategy, lTags(video.uuid)) - const trackerUrls = await TrackerModel.listUrlsByVideoId(video.id) - const magnetUri = generateMagnetUri(video, file, trackerUrls) - - const tmpPath = await downloadWebTorrentVideo({ magnetUri }, VIDEO_IMPORT_TIMEOUT) + const tmpPath = await downloadWebTorrentVideo({ uri: file.torrentUrl }, VIDEO_IMPORT_TIMEOUT) const destPath = join(CONFIG.STORAGE.REDUNDANCY_DIR, file.filename) await move(tmpPath, destPath, { overwrite: true }) -- cgit v1.2.3