private static async Task <(long max, long total)> CollectRecordsFromNodes(ClusterRecordsCounter crc) { var apiByName = new Dictionary <string, BobApiClient>(); var vdisks = new List <VDisk>(); foreach (var node in configuration.Nodes) { try { var api = new BobApiClient(node.Address); var status = await api.GetStatus(); if (status == null) { logger.LogError($"Node {node.Address} not available"); continue; } apiByName.Add(status?.Name, api); foreach (var vdisk in status?.VDisks) { if (!vdisks.Any(vd => vd.Id == vdisk.Id)) { vdisks.Add(vdisk); } } } catch (Exception e) { logger.LogError($"Error getting info from node {node.Address}, {e.Message}"); } } return(await crc.CountRecords(apiByName, vdisks)); }
private static async Task <(long max, long total)> CollectRecordsInWholeCluster(ClusterRecordsCounter crc) { foreach (var node in configuration.Nodes) { try { return(await crc.CountRecordsInCluster(node.Address)); } catch (Exception e) { logger.LogError($"Failed to parse node from address {node.Address}: {e.Message}"); } } return(0, 0); }