diff --git a/src/TopoMojo.Api/Features/Template/TemplateService.cs b/src/TopoMojo.Api/Features/Template/TemplateService.cs index 1e5b0ed..3f92a00 100644 --- a/src/TopoMojo.Api/Features/Template/TemplateService.cs +++ b/src/TopoMojo.Api/Features/Template/TemplateService.cs @@ -253,7 +253,7 @@ public async Task CheckHealth(string id) var template = await GetDeployableTemplate(id); var vm = await _pod.Refresh(template); if (vm.Status == "created") // healthy is 'initialized' for existing template - throw new Exception("bad health"); + throw new Exception("unhealthy"); } } } diff --git a/src/TopoMojo.Hypervisor/vSphere/VimClient.cs b/src/TopoMojo.Hypervisor/vSphere/VimClient.cs index 4512073..cdf8f1f 100644 --- a/src/TopoMojo.Hypervisor/vSphere/VimClient.cs +++ b/src/TopoMojo.Hypervisor/vSphere/VimClient.cs @@ -1278,10 +1278,16 @@ private async Task MonitorSession() catch (Exception ex) { _logger.LogError(0, ex, $"Failed to refresh cache for {_config.Host}"); + + if (ex.GetType().Name.Contains("ServerTooBusy")) + await Disconnect(); } finally { await Task.Delay(_syncInterval); + + if (_vim == null) + await Connect(); } } // _logger.LogDebug("sessionMonitor ended.");