Put retries on overall extract operation
This commit is contained in:
parent
bc833492f0
commit
8e0722085d
|
@ -265,18 +265,32 @@ namespace MediaBrowser.Installer
|
||||||
{
|
{
|
||||||
// Extract
|
// Extract
|
||||||
lblStatus.Text = "Extracting Package...";
|
lblStatus.Text = "Extracting Package...";
|
||||||
try
|
var retryCount = 0;
|
||||||
|
var success = false;
|
||||||
|
while (!success && retryCount < 3)
|
||||||
{
|
{
|
||||||
ExtractPackage(archive);
|
try
|
||||||
// We're done with it so delete it (this is necessary for update operations)
|
{
|
||||||
TryDelete(archive);
|
ExtractPackage(archive);
|
||||||
}
|
success = true;
|
||||||
catch (Exception e)
|
// We're done with it so delete it (this is necessary for update operations)
|
||||||
{
|
TryDelete(archive);
|
||||||
SystemClose("Error Extracting - " + e.GetType().FullName + "\n\n" + e.Message);
|
}
|
||||||
// Delete archive even if failed so we don't try again with this one
|
catch (Exception e)
|
||||||
TryDelete(archive);
|
{
|
||||||
return;
|
if (retryCount < 3)
|
||||||
|
{
|
||||||
|
retryCount++;
|
||||||
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Delete archive even if failed so we don't try again with this one
|
||||||
|
TryDelete(archive);
|
||||||
|
SystemClose("Error Extracting - " + e.GetType().FullName + "\n\n" + e.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create shortcut
|
// Create shortcut
|
||||||
|
@ -496,7 +510,6 @@ namespace MediaBrowser.Installer
|
||||||
{
|
{
|
||||||
//Rollback
|
//Rollback
|
||||||
RollBack(systemDir, backupDir);
|
RollBack(systemDir, backupDir);
|
||||||
TryDelete(archive); // so we don't try again if its an update
|
|
||||||
throw new ApplicationException(string.Format("Could not extract {0} to {1} after {2} attempts.\n\n{3}", archive, RootPath, retryCount, e.Message));
|
throw new ApplicationException(string.Format("Could not extract {0} to {1} after {2} attempts.\n\n{3}", archive, RootPath, retryCount, e.Message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user