From ed72c158023e68b06131a9e79c983655427c3240 Mon Sep 17 00:00:00 2001 From: zirain Date: Tue, 27 Dec 2022 23:16:18 +0800 Subject: [PATCH] simplify ProviderResources close (#835) --- internal/cmd/server.go | 6 +----- internal/message/types.go | 8 ++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/cmd/server.go b/internal/cmd/server.go index cc309e140a2..3361c9acfbb 100644 --- a/internal/cmd/server.go +++ b/internal/cmd/server.go @@ -155,11 +155,7 @@ func setupRunners(cfg *config.Server) error { // Wait until done <-ctx.Done() // Close messages - pResources.GatewayAPIResources.Close() - pResources.GatewayStatuses.Close() - pResources.HTTPRouteStatuses.Close() - pResources.TLSRouteStatuses.Close() - pResources.UDPRouteStatuses.Close() + pResources.Close() xdsIR.Close() infraIR.Close() xds.Close() diff --git a/internal/message/types.go b/internal/message/types.go index 70aad839d95..2a272b6b55f 100644 --- a/internal/message/types.go +++ b/internal/message/types.go @@ -48,6 +48,14 @@ func (p *ProviderResources) GetResourcesKey() string { return "" } +func (p *ProviderResources) Close() { + p.GatewayAPIResources.Close() + p.GatewayStatuses.Close() + p.HTTPRouteStatuses.Close() + p.TLSRouteStatuses.Close() + p.UDPRouteStatuses.Close() +} + // XdsIR message type XdsIR struct { watchable.Map[string, *ir.Xds]