diff --git a/DUI3/Speckle.Connectors.DUI/Bindings/SendOperationManager.cs b/DUI3/Speckle.Connectors.DUI/Bindings/SendOperationManager.cs index 7f6341502..95ea9ba28 100644 --- a/DUI3/Speckle.Connectors.DUI/Bindings/SendOperationManager.cs +++ b/DUI3/Speckle.Connectors.DUI/Bindings/SendOperationManager.cs @@ -76,6 +76,7 @@ public sealed class SendOperationManager( ) { using var activity = activityFactory.Start(); + var sendConversionCache = serviceScope.ServiceProvider.GetRequiredService(); try { if (store.GetModelById(modelCardId) is not SenderModelCard modelCard) @@ -83,6 +84,7 @@ public sealed class SendOperationManager( // Handle as GLOBAL ERROR at BrowserBridge throw new InvalidOperationException("No publish model card was found."); } + using SendInfo sendInfo = GetSendInfo(modelCard); using var userScope = UserActivityScope.AddUserScope(sendInfo.Account); @@ -94,7 +96,6 @@ public sealed class SendOperationManager( var configStore = serviceScope.ServiceProvider.GetRequiredService(); if (configStore.GetConnectorConfig().DisableCache) { - var sendConversionCache = serviceScope.ServiceProvider.GetRequiredService(); sendConversionCache.ClearCache(); // clear whatever is currently in there to ensure 0% cache hits sendConversionCache.IsBypassed = true; // tells cache to ignore any future write requests during this scoped operation } @@ -139,6 +140,11 @@ public sealed class SendOperationManager( logger.LogModelCardHandledError(ex); await commands.SetModelError(modelCardId, ex); } + finally + { + // state always reset to false + sendConversionCache.IsBypassed = false; + } } private SendInfo GetSendInfo(SenderModelCard modelCard)