do not loose proxy objects when setting state
@@ -30,11 +30,11 @@ public class TimerProxy {
// out of date
if (proxy.Outdated && !(await _context.ProxyOperations.IsUsed(proxy))) {
_logger.Warning($"scaleset-proxy: outdated and not used: {proxy.Region}");
- await proxyOperations.SetState(proxy, VmState.Stopping);
+ proxy = await proxyOperations.SetState(proxy, VmState.Stopping);
// If something is "wrong" with a proxy, delete & recreate it
} else if (!proxyOperations.IsAlive(proxy)) {
_logger.Error($"scaleset-proxy: alive check failed, stopping: {proxy.Region}");
- await proxyOperations.SetState(proxy, VmState.Stopping);
+ proxy = await proxyOperations.SetState(proxy, VmState.Stopping);
} else {
await proxyOperations.SaveProxyConfig(proxy);
}
@@ -89,7 +89,9 @@ public class TimerProxy {
await foreach (var nsg in nsgOpertions.ListNsgs()) {
if (nsgOpertions.OkToDelete(regions, nsg.Data.Location!, nsg.Data.Name)) {
if (nsg.Data.NetworkInterfaces.Count == 0 && nsg.Data.Subnets.Count == 0) {
- await nsgOpertions.StartDeleteNsg(nsg.Data.Name);
+ if (!await nsgOpertions.StartDeleteNsg(nsg.Data.Name)) {
+ _logger.Warning($"failed to start deleting NSG {nsg.Data.Name}");
+ }
}
}
}
