lock RealDebridUpdateLock when dequeuing, not when adding to the queue
This commit is contained in:
parent
ea3839514d
commit
e7c2b42bd2
1 changed files with 27 additions and 27 deletions
|
|
@ -227,6 +227,10 @@ public class Torrents(
|
||||||
|
|
||||||
logger.LogDebug("Adding {hash} to debrid provider {torrentInfo}", torrent.Hash, torrent.ToLog());
|
logger.LogDebug("Adding {hash} to debrid provider {torrentInfo}", torrent.Hash, torrent.ToLog());
|
||||||
|
|
||||||
|
await RealDebridUpdateLock.WaitAsync();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
var id = torrent.IsFile
|
var id = torrent.IsFile
|
||||||
? await TorrentClient.AddFile(Convert.FromBase64String(torrent.FileOrMagnet))
|
? await TorrentClient.AddFile(Convert.FromBase64String(torrent.FileOrMagnet))
|
||||||
: await TorrentClient.AddMagnet(torrent.FileOrMagnet);
|
: await TorrentClient.AddMagnet(torrent.FileOrMagnet);
|
||||||
|
|
@ -237,6 +241,11 @@ public class Torrents(
|
||||||
|
|
||||||
return torrent;
|
return torrent;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
RealDebridUpdateLock.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<IList<TorrentClientAvailableFile>> GetAvailableFiles(String hash)
|
public async Task<IList<TorrentClientAvailableFile>> GetAvailableFiles(String hash)
|
||||||
{
|
{
|
||||||
|
|
@ -726,10 +735,6 @@ public class Torrents(
|
||||||
String fileOrMagnetContents,
|
String fileOrMagnetContents,
|
||||||
Boolean isFile,
|
Boolean isFile,
|
||||||
Torrent torrent)
|
Torrent torrent)
|
||||||
{
|
|
||||||
await RealDebridUpdateLock.WaitAsync();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var existingTorrent = await torrentData.GetByHash(infoHash);
|
var existingTorrent = await torrentData.GetByHash(infoHash);
|
||||||
|
|
||||||
|
|
@ -747,11 +752,6 @@ public class Torrents(
|
||||||
|
|
||||||
return newTorrent;
|
return newTorrent;
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
RealDebridUpdateLock.Release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Update(Torrent torrent)
|
public async Task Update(Torrent torrent)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue