The Free Software Media System - Server Backend & API
Put retries on overall extract operation
Eric Reed8e0722085d55
diff --git a/MediaBrowser.Installer/MainWindow.xaml.cs b/MediaBrowser.Installer/MainWindow.xaml.csindex 16cde95925..6e4ad1258d 100644--- a/MediaBrowser.Installer/MainWindow.xaml.cs+++ b/MediaBrowser.Installer/MainWindow.xaml.cs@@ -265,18 +265,32 @@ namespace MediaBrowser.Installer{// ExtractlblStatus.Text = "Extracting Package...";- try- {- ExtractPackage(archive);- // We're done with it so delete it (this is necessary for update operations)- TryDelete(archive);- }- catch (Exception e)+ var retryCount = 0;+ var success = false;+ while (!success && retryCount < 3){- SystemClose("Error Extracting - " + e.GetType().FullName + "\n\n" + e.Message);- // Delete archive even if failed so we don't try again with this one- TryDelete(archive);- return;+ try+ {+ ExtractPackage(archive);+ success = true;+ // We're done with it so delete it (this is necessary for update operations)+ TryDelete(archive);+ }+ catch (Exception e)+ {+ 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@@ -496,7 +510,6 @@ namespace MediaBrowser.Installer{//RollbackRollBack(systemDir, backupDir);- TryDelete(archive); // so we don't try again if its an updatethrow new ApplicationException(string.Format("Could not extract {0} to {1} after {2} attempts.\n\n{3}", archive, RootPath, retryCount, e.Message));}}