- Applied to TorBox, can be extended easily to other providers - Reads response headers commonplace for pre-emptive rate limit throttling and retry-after - When a rate limit is reached, displays a warning in the UI - Fix socket leak from direct allocation of HttpClient, replaced with factory which handles pooling and re-use of sockets. While HttpClient is Disposable, it doesn't gaurantee (and does not) directly release underlying sockets for queries at the time the client is disposed. These sockets will go into a TCP WAIT state often for a very long time. The expected pattern in C# is to always use the HttClientFactory which will correctly handle re-use of the OS sockets in suqsequent queries reducing resource and memory leaks.
31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using RdtClient.Data.Enums;
|
|
using RdtClient.Data.Models.Data;
|
|
|
|
namespace RdtClient.Data.Data;
|
|
|
|
public interface ITorrentData
|
|
{
|
|
Task<IList<Torrent>> Get();
|
|
Task<Torrent?> GetById(Guid torrentId);
|
|
Task<Torrent?> GetByHash(String hash);
|
|
|
|
Task<Torrent> Add(String? rdId,
|
|
String hash,
|
|
String? fileOrMagnetContents,
|
|
Boolean isFile,
|
|
DownloadType downloadType,
|
|
DownloadClient downloadClient,
|
|
Torrent torrent);
|
|
|
|
Task UpdateRdData(Torrent torrent);
|
|
Task UpdateRdId(Torrent torrent, String rdId);
|
|
Task UpdateHash(Torrent torrent, String hash);
|
|
Task Update(Torrent torrent);
|
|
Task UpdateCategory(Guid torrentId, String? category);
|
|
Task UpdateComplete(Guid torrentId, String? error, DateTimeOffset? datetime, Boolean retry);
|
|
Task UpdateFilesSelected(Guid torrentId, DateTimeOffset datetime);
|
|
Task UpdatePriority(Guid torrentId, Int32? priority);
|
|
Task UpdateRetry(Guid torrentId, DateTimeOffset? dateTime, Int32 retryCount);
|
|
Task UpdateError(Guid torrentId, String error);
|
|
Task Delete(Guid torrentId);
|
|
}
|