From 98837577047b8ce087f89a162acda3aeea2b9d69 Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 4 Jan 2018 15:34:22 +0100 Subject: [PATCH] U4-10739 - cosmetics --- src/Umbraco.Core/IO/PhysicalFileSystem.cs | 27 +++++++++-------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/Umbraco.Core/IO/PhysicalFileSystem.cs b/src/Umbraco.Core/IO/PhysicalFileSystem.cs index df72164b20..6cd709f2d3 100644 --- a/src/Umbraco.Core/IO/PhysicalFileSystem.cs +++ b/src/Umbraco.Core/IO/PhysicalFileSystem.cs @@ -424,31 +424,26 @@ namespace Umbraco.Core.IO const int count = 10; const int pausems = 100; - for (var i = 0;i < count; i++) + for (var i = 0;; i++) { try { - action(); - // don't retry if the action succeeded - i = count; + action(); + break; // done } catch (IOException e) - { - // if it's not *exactly* IOException then it could be - // some inherited exception such as FileNotFoundException, + { + // if it's not *exactly* IOException then it could be + // some inherited exception such as FileNotFoundException, // and then we don't want to retry if (e.GetType() != typeof(IOException)) throw; - - // wait and retry - if (i < count-1) - { - Thread.Sleep(pausems); - continue; - } - // throw if out of retries - throw; + // if we have tried enough, throw, else swallow + // the exception and retry after a pause + if (i == count) throw; } + + Thread.Sleep(pausems); } }