Skip to content

Commit b35b093

Browse files
committed
fix(graphql-api): Fixed that torrents could be added twice
1 parent 725db78 commit b35b093

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

apps/graphql-api/src/shared/torrent/torrent.service.ts

+10
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,16 @@ export class TorrentService {
258258
return resolve()
259259
}
260260

261+
const downloadIsAlreadyConnecting = !!this.getConnectingTorrentForDownload(download)
262+
const downloadIsAlreadyDownloading = !!this.getTorrentForDownload(download)
263+
264+
// Prevents the item from being added twice
265+
if (downloadIsAlreadyConnecting || downloadIsAlreadyDownloading) {
266+
this.logger.log(`[${download._id}]: Download is already going`)
267+
268+
return resolve()
269+
}
270+
261271
const item = await this.getItemForDownload(download)
262272

263273
const { torrents, searchedTorrents } = item

0 commit comments

Comments
 (0)