diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-24 09:19:02 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-24 09:19:02 +0100 |
commit | 17e2705f646f00346bfdbb663876b0f022eaeee3 (patch) | |
tree | 872fdab861fb7b45babd75ab0a787630a1ff5a73 /shared/extra-utils/miscs/webtorrent.ts | |
parent | 842a15732b5ddcd9c9c90e790a448235800ef870 (diff) | |
download | PeerTube-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.ts | 4 |
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 | |||
10 | function webtorrentAdd (torrentId: string, refreshWebTorrent = false) { | 10 | function 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 | ||