Fixed bug in the download client.
This commit is contained in:
parent
bc552612f5
commit
cd2f29e9f5
2 changed files with 9 additions and 5 deletions
|
|
@ -33,8 +33,8 @@ namespace RdtClient.Service.Services
|
|||
public Int64 BytesTotal { get; private set; }
|
||||
public Int64 BytesDone { get; private set; }
|
||||
|
||||
private static Int64 LastTick { get; set; }
|
||||
private static ConcurrentBag<Double> AverageSpeed { get; } = new ConcurrentBag<Double>();
|
||||
private Int64 LastTick { get; set; }
|
||||
private ConcurrentBag<Double> AverageSpeed { get; } = new ConcurrentBag<Double>();
|
||||
|
||||
public async Task Start(Boolean onTheFlyDownload, String tempDirectory, Int32 chunkCount, Int64 maximumBytesPerSecond)
|
||||
{
|
||||
|
|
@ -123,7 +123,11 @@ namespace RdtClient.Service.Services
|
|||
LastTick = Environment.TickCount;
|
||||
}
|
||||
|
||||
Speed = (Int64) AverageSpeed.Average();
|
||||
if (AverageSpeed.Count > 0)
|
||||
{
|
||||
Speed = (Int64) AverageSpeed.Average();
|
||||
}
|
||||
|
||||
BytesDone = args.ReceivedBytesSize;
|
||||
BytesTotal = args.TotalBytesToReceive;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -161,14 +161,14 @@ namespace RdtClient.Service.Services
|
|||
|
||||
var torrents = await _torrents.Get();
|
||||
|
||||
// Only poll RealDebrid every 5 when a hub is connected, otherwise ever 30 seconds
|
||||
// Only poll RealDebrid every second when a hub is connected, otherwise every 30 seconds
|
||||
if (_nextUpdate < DateTime.UtcNow && torrents.Count > 0)
|
||||
{
|
||||
var updateTime = 30;
|
||||
|
||||
if (RdtHub.HasConnections)
|
||||
{
|
||||
updateTime = 5;
|
||||
updateTime = 1;
|
||||
}
|
||||
|
||||
_nextUpdate = DateTime.UtcNow.AddSeconds(updateTime);
|
||||
|
|
|
|||
Loading…
Reference in a new issue