From: Chocobozzz Date: Wed, 24 Nov 2021 08:19:02 +0000 (+0100) Subject: Fix tests X-Git-Tag: v4.0.0-rc.1~31 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=17e2705f646f00346bfdbb663876b0f022eaeee3;p=github%2FChocobozzz%2FPeerTube.git Fix tests --- 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 function webtorrentAdd (torrentId: string, refreshWebTorrent = false) { const WebTorrent = require('webtorrent') - if (!webtorrent) webtorrent = new WebTorrent() - if (refreshWebTorrent === true) webtorrent = new WebTorrent() + if (webtorrent && refreshWebTorrent) webtorrent.destroy() + if (!webtorrent || refreshWebTorrent) webtorrent = new WebTorrent() webtorrent.on('error', err => console.error('Error in webtorrent', err))