diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2013-04-15 08:00:48 -0400 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2013-04-15 08:00:48 -0400 |
| commit | 8e0722085d55b96ffc9aad330f63d1869835478c (patch) | |
| tree | 3e9a02b67e4a2593149048ec135423e955df02ed /MediaBrowser.Installer/MainWindow.xaml.cs | |
| parent | bc833492f0c27fbd106b170984f80ac133341396 (diff) | |
Put retries on overall extract operation
Diffstat (limited to 'MediaBrowser.Installer/MainWindow.xaml.cs')
| -rw-r--r-- | MediaBrowser.Installer/MainWindow.xaml.cs | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/MediaBrowser.Installer/MainWindow.xaml.cs b/MediaBrowser.Installer/MainWindow.xaml.cs index 16cde9592..6e4ad1258 100644 --- a/MediaBrowser.Installer/MainWindow.xaml.cs +++ b/MediaBrowser.Installer/MainWindow.xaml.cs @@ -265,18 +265,32 @@ namespace MediaBrowser.Installer { // Extract lblStatus.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 { //Rollback 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)); } } |
