plugin/grpc: close clients on shutdown (#8582)

This PR closes from the plugin shutdown hook

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2026-09-29 01:19:28 -07:00
committed by GitHub
parent 594d6c9121
commit d821a74af8
4 changed files with 77 additions and 0 deletions

View File

@@ -139,6 +139,15 @@ func (g *GRPC) Name() string { return "grpc" }
// Len returns the number of configured proxies.
func (g *GRPC) len() int { return len(g.proxies) }
// OnShutdown closes all configured upstream connections.
func (g *GRPC) OnShutdown() error {
var err error
for _, p := range g.proxies {
err = errors.Join(err, p.close())
}
return err
}
func (g *GRPC) match(state request.Request) bool {
if !plugin.Name(g.from).Matches(state.Name()) || !g.isAllowedDomain(state.Name()) {
return false