aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/webtorrent.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-09-06 09:29:25 +0200
committerChocobozzz <me@florianbigard.com>2021-09-06 16:19:49 +0200
commit02b286f89088e07cac7e7068e884d3be0fd0098b (patch)
treec98e159e6ee4512bb7026d052f565fcecc840124 /server/helpers/webtorrent.ts
parent70430c2796b6c0455a863edc62760a3d45951fc5 (diff)
downloadPeerTube-02b286f89088e07cac7e7068e884d3be0fd0098b.tar.gz
PeerTube-02b286f89088e07cac7e7068e884d3be0fd0098b.tar.zst
PeerTube-02b286f89088e07cac7e7068e884d3be0fd0098b.zip
More robust webtorrent redundancy download
Avoid issues with inconsistencies between magnet infohash and torrent infohash, blocking webtorrent upload that will timeout
Diffstat (limited to 'server/helpers/webtorrent.ts')
-rw-r--r--server/helpers/webtorrent.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts
index 83b46e085..5e1ea6198 100644
--- a/server/helpers/webtorrent.ts
+++ b/server/helpers/webtorrent.ts
@@ -21,8 +21,8 @@ import { extractVideo } from './video'
21 21
22const createTorrentPromise = promisify2<string, any, any>(createTorrent) 22const createTorrentPromise = promisify2<string, any, any>(createTorrent)
23 23
24async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName?: string }, timeout: number) { 24async function downloadWebTorrentVideo (target: { uri: string, torrentName?: string }, timeout: number) {
25 const id = target.magnetUri || target.torrentName 25 const id = target.uri || target.torrentName
26 let timer 26 let timer
27 27
28 const path = generateVideoImportTmpPath(id) 28 const path = generateVideoImportTmpPath(id)
@@ -35,7 +35,7 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName
35 const webtorrent = new WebTorrent() 35 const webtorrent = new WebTorrent()
36 let file: TorrentFile 36 let file: TorrentFile
37 37
38 const torrentId = target.magnetUri || join(CONFIG.STORAGE.TORRENTS_DIR, target.torrentName) 38 const torrentId = target.uri || join(CONFIG.STORAGE.TORRENTS_DIR, target.torrentName)
39 39
40 const options = { path: directoryPath } 40 const options = { path: directoryPath }
41 const torrent = webtorrent.add(torrentId, options, torrent => { 41 const torrent = webtorrent.add(torrentId, options, torrent => {