Skip to content

Commit

Permalink
fix(graphql-api): Fixed that torrents could be added twice
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs committed Sep 21, 2020
1 parent 725db78 commit b35b093
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/graphql-api/src/shared/torrent/torrent.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,16 @@ export class TorrentService {
return resolve()
}

const downloadIsAlreadyConnecting = !!this.getConnectingTorrentForDownload(download)
const downloadIsAlreadyDownloading = !!this.getTorrentForDownload(download)

// Prevents the item from being added twice
if (downloadIsAlreadyConnecting || downloadIsAlreadyDownloading) {
this.logger.log(`[${download._id}]: Download is already going`)

return resolve()
}

const item = await this.getItemForDownload(download)

const { torrents, searchedTorrents } = item
Expand Down

0 comments on commit b35b093

Please sign in to comment.