docs(mesh): correct the all-malformed-cluster comments in CentralCommunicationActor
The per-cluster contact map only gains a key when a row parses, so an all-malformed cluster has no key at all and is caught by the absent-key arm; the empty-set guard is defensive/unreachable for the DB producer. Comment-only (Task 4 code-review minor follow-up). Claude-Session: https://claude.ai/code/session_01GASWkNEi68FSCtvr6rLoEW
This commit is contained in:
+7
-4
@@ -258,8 +258,9 @@ public sealed class CentralCommunicationActor : ReceiveActor, IWithTimers
|
|||||||
kv => kv.Key, kv => kv.Value.ToImmutableHashSet());
|
kv => kv.Key, kv => kv.Value.ToImmutableHashSet());
|
||||||
|
|
||||||
// Clusters that dropped out of the DB entirely, or whose only rows were malformed this refresh:
|
// Clusters that dropped out of the DB entirely, or whose only rows were malformed this refresh:
|
||||||
// stop and forget their clients so a vanished cluster stops receiving. A cluster whose rows all
|
// stop and forget their clients so a vanished cluster stops receiving. LoadContactsFromDb only
|
||||||
// went malformed lands here via the empty-set branch.
|
// creates a ByCluster key when at least one of its rows parsed, so an all-malformed cluster has
|
||||||
|
// NO key at all and is caught here by the absent-key (!TryGetValue) arm — not by an empty value.
|
||||||
var gone = _clients.Keys
|
var gone = _clients.Keys
|
||||||
.Where(id => !byCluster.TryGetValue(id, out var c) || c.IsEmpty)
|
.Where(id => !byCluster.TryGetValue(id, out var c) || c.IsEmpty)
|
||||||
.ToList();
|
.ToList();
|
||||||
@@ -277,8 +278,10 @@ public sealed class CentralCommunicationActor : ReceiveActor, IWithTimers
|
|||||||
{
|
{
|
||||||
if (contacts.IsEmpty)
|
if (contacts.IsEmpty)
|
||||||
{
|
{
|
||||||
// Only-malformed rows for this cluster this refresh. Warn per cluster; its client (if
|
// Defensive: LoadContactsFromDb never emits an empty-but-present cluster (a key is
|
||||||
// any) was already stopped above.
|
// created only on a first successfully-parsed row), so this arm is unreachable for the
|
||||||
|
// DB producer — an all-malformed cluster is handled by the absent-key branch above. It
|
||||||
|
// guards a ContactsLoaded (a public record) constructed elsewhere with an empty list.
|
||||||
_log.Warning(
|
_log.Warning(
|
||||||
"Cluster {ClusterId} has no usable ClusterNode contact points; no ClusterClient "
|
"Cluster {ClusterId} has no usable ClusterNode contact points; no ClusterClient "
|
||||||
+ "was created for it and its nodes' commands will be dropped until a refresh finds "
|
+ "was created for it and its nodes' commands will be dropped until a refresh finds "
|
||||||
|
|||||||
Reference in New Issue
Block a user