diff --git a/Duplicati/Library/Main/Operation/Common/BackendHandler.cs b/Duplicati/Library/Main/Operation/Common/BackendHandler.cs index 4c34df39c..0b1a175a6 100644 --- a/Duplicati/Library/Main/Operation/Common/BackendHandler.cs +++ b/Duplicati/Library/Main/Operation/Common/BackendHandler.cs @@ -321,11 +321,6 @@ namespace Duplicati.Library.Main.Operation.Common private async Task DoWithRetry(FileEntryItem item, Func> method) { - if (m_backend == null) - m_backend = DynamicLoader.BackendLoader.GetBackend(m_backendurl, m_options.RawOptions); - if (m_backend == null) - throw new Exception("Backend failed to re-load"); - item.IsRetry = false; Exception lastException = null; @@ -333,9 +328,14 @@ namespace Duplicati.Library.Main.Operation.Common { if (m_options.RetryDelay.Ticks != 0 && i != 0) await Task.Delay(m_options.RetryDelay); - + try { + if (m_backend == null) + m_backend = DynamicLoader.BackendLoader.GetBackend(m_backendurl, m_options.RawOptions); + if (m_backend == null) + throw new Exception("Backend failed to re-load"); + var r = await method(); return r; }