fixes uploads cancelling early
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors></Authors>
|
<Authors></Authors>
|
||||||
<Company></Company>
|
<Company></Company>
|
||||||
<Version>0.5.7</Version>
|
<Version>0.5.8</Version>
|
||||||
<Description></Description>
|
<Description></Description>
|
||||||
<Copyright></Copyright>
|
<Copyright></Copyright>
|
||||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||||
|
|||||||
@@ -239,22 +239,13 @@ public partial class ApiController
|
|||||||
Logger.Debug($"Compressed {totalSize} to {compressedSize} ({(compressedSize / (double)totalSize):P2})");
|
Logger.Debug($"Compressed {totalSize} to {compressedSize} ({(compressedSize / (double)totalSize):P2})");
|
||||||
|
|
||||||
Logger.Debug("Upload tasks complete, waiting for server to confirm");
|
Logger.Debug("Upload tasks complete, waiting for server to confirm");
|
||||||
var anyUploadsOpen = await FilesIsUploadFinished().ConfigureAwait(false);
|
Logger.Debug("Uploads open: " + CurrentUploads.Any(c => c.IsInTransfer));
|
||||||
Logger.Debug("Uploads open: " + anyUploadsOpen);
|
|
||||||
double timeWaited = 0;
|
|
||||||
const double waitStep = 1.0d;
|
const double waitStep = 1.0d;
|
||||||
while (anyUploadsOpen && !uploadToken.IsCancellationRequested && timeWaited < 5)
|
while (CurrentUploads.Any(c => c.IsInTransfer) && !uploadToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
anyUploadsOpen = await FilesIsUploadFinished().ConfigureAwait(false);
|
|
||||||
timeWaited += waitStep;
|
|
||||||
await Task.Delay(TimeSpan.FromSeconds(waitStep), uploadToken).ConfigureAwait(false);
|
await Task.Delay(TimeSpan.FromSeconds(waitStep), uploadToken).ConfigureAwait(false);
|
||||||
Logger.Debug("Waiting for uploads to finish");
|
Logger.Debug("Waiting for uploads to finish");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(timeWaited > waitStep)
|
|
||||||
{
|
|
||||||
await FilesAbortUpload().ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var item in unverifiedUploadHashes)
|
foreach (var item in unverifiedUploadHashes)
|
||||||
|
|||||||
Reference in New Issue
Block a user