Merge pull request #812 from Cucumberrbob/fix/realdebridupdatelock-when-dequeueing

fix: lock RealDebridUpdateLock when dequeuing, not when adding to the queue
This commit is contained in:
Roger Far 2025-05-18 11:05:53 -06:00 committed by GitHub
commit b7efb78814
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -227,6 +227,10 @@ public class Torrents(
logger.LogDebug("Adding {hash} to debrid provider {torrentInfo}", torrent.Hash, torrent.ToLog());
await RealDebridUpdateLock.WaitAsync();
try
{
var id = torrent.IsFile
? await TorrentClient.AddFile(Convert.FromBase64String(torrent.FileOrMagnet))
: await TorrentClient.AddMagnet(torrent.FileOrMagnet);
@ -237,6 +241,11 @@ public class Torrents(
return torrent;
}
finally
{
RealDebridUpdateLock.Release();
}
}
public async Task<IList<TorrentClientAvailableFile>> GetAvailableFiles(String hash)
{
@ -726,10 +735,6 @@ public class Torrents(
String fileOrMagnetContents,
Boolean isFile,
Torrent torrent)
{
await RealDebridUpdateLock.WaitAsync();
try
{
var existingTorrent = await torrentData.GetByHash(infoHash);
@ -747,11 +752,6 @@ public class Torrents(
return newTorrent;
}
finally
{
RealDebridUpdateLock.Release();
}
}
public async Task Update(Torrent torrent)
{