aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/miscs/webtorrent.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-11-24 09:19:02 +0100
committerChocobozzz <me@florianbigard.com>2021-11-24 09:19:02 +0100
commit17e2705f646f00346bfdbb663876b0f022eaeee3 (patch)
tree872fdab861fb7b45babd75ab0a787630a1ff5a73 /shared/extra-utils/miscs/webtorrent.ts
parent842a15732b5ddcd9c9c90e790a448235800ef870 (diff)
downloadPeerTube-17e2705f646f00346bfdbb663876b0f022eaeee3.tar.gz
PeerTube-17e2705f646f00346bfdbb663876b0f022eaeee3.tar.zst
PeerTube-17e2705f646f00346bfdbb663876b0f022eaeee3.zip
Fix tests
Diffstat (limited to 'shared/extra-utils/miscs/webtorrent.ts')
-rw-r--r--shared/extra-utils/miscs/webtorrent.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/shared/extra-utils/miscs/webtorrent.ts b/shared/extra-utils/miscs/webtorrent.ts
index b610fdda8..0683f8893 100644
--- a/shared/extra-utils/miscs/webtorrent.ts
+++ b/shared/extra-utils/miscs/webtorrent.ts
@@ -10,8 +10,8 @@ let webtorrent: WebTorrent.Instance
10function webtorrentAdd (torrentId: string, refreshWebTorrent = false) { 10function webtorrentAdd (torrentId: string, refreshWebTorrent = false) {
11 const WebTorrent = require('webtorrent') 11 const WebTorrent = require('webtorrent')
12 12
13 if (!webtorrent) webtorrent = new WebTorrent() 13 if (webtorrent && refreshWebTorrent) webtorrent.destroy()
14 if (refreshWebTorrent === true) webtorrent = new WebTorrent() 14 if (!webtorrent || refreshWebTorrent) webtorrent = new WebTorrent()
15 15
16 webtorrent.on('error', err => console.error('Error in webtorrent', err)) 16 webtorrent.on('error', err => console.error('Error in webtorrent', err))
17 17