mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-31 02:51:51 -07:00
## What changed? Both downstream client caches now close a cached `*grpc.ClientConn` when its host leaves the membership ring, instead of holding it until gRPC's idle timeout: - History `connectionPool` subscribes to the history ring and closes departed hosts' conns. - Matching `ClientCache` gains `Evict` + a per-entry release fn; `matching.NewClient` subscribes to the matching ring and evicts departed hosts. Both wait a configurable drain delay before closing — new `history.connectionCloseDelay` / `matching.connectionCloseDelay` settings (default 30s) — so in-flight RPCs can finish. The eviction goroutines are tied to the owning client via `runtime.AddCleanup`. ## Why? After #9277 removed the RPCFactory cache, these downstream caches still held `*grpc.ClientConn` forever, so #8719's dial-timeout log spam just moved down a layer. Closing conns on ring departure fixes it at the source. ## How did you test it? - [x] built - [x] covered by existing tests ## Potential risks `CachingRedirector` (non-default; `HistoryClientOwnershipCachingEnabled=false`) is unchanged and still relies on gRPC's idle timeout for stale-conn cleanup, same as today. --------- Co-authored-by: David Reiss <david@temporal.io>