From 17e2705f646f00346bfdbb663876b0f022eaeee3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 24 Nov 2021 09:19:02 +0100 Subject: Fix tests --- shared/extra-utils/miscs/webtorrent.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shared/extra-utils') 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)) -- cgit v1.2.3