fix(communication): guard per-site ClusterClient creation; add real-factory address-edit lifecycle test

This commit is contained in:
Joseph Doherty
2026-07-08 14:57:13 -04:00
parent 75cbac4478
commit f91e75bfe4
2 changed files with 97 additions and 1 deletions
@@ -539,9 +539,23 @@ public class CentralCommunicationActor : ReceiveActor
{
_log.Info("Updating ClusterClient for site {0} (addresses changed)", siteId);
Context.Stop(_siteClients[siteId].Client);
// Remove now: if the replacement create below fails, a stale entry
// would route envelopes to a stopping actor.
_siteClients.Remove(siteId);
}
var client = _siteClientFactory.Create(Context.System, siteId, contactPaths);
IActorRef client;
try
{
client = _siteClientFactory.Create(Context.System, siteId, contactPaths);
}
catch (Exception ex)
{
_log.Error(ex,
"Failed to create ClusterClient for site {0}; site is unroutable until the next refresh",
siteId);
continue;
}
_siteClients[siteId] = (client, contactStrings);
_log.Info("Created ClusterClient for site {0} with {1} contact(s)", siteId, addresses.Count);
}