fix(resolver): fix async context leak, gRPC error swallowing, add 48 tests

Fix async resolve goroutine using caller's cancelable context by
switching to context.WithoutCancel. Fix NewGRPCPlugin silently
returning broken resolver on connection failure. Fix "resolover"
typo in log field. Add doc comments to all exported symbols.
This commit is contained in:
ginuerzh
2026-05-25 20:52:19 +08:00
parent acce86c0e4
commit 28d3ffa310
7 changed files with 916 additions and 9 deletions
+6 -8
View File
@@ -27,19 +27,17 @@ func NewGRPCPlugin(name string, addr string, opts ...plugin.Option) (resolver.Re
}
log := logger.Default().WithFields(map[string]any{
"kind": "resolver",
"resolover": name,
"kind": "resolver",
"resolver": name,
})
conn, err := plugin.NewGRPCConn(addr, &options)
if err != nil {
log.Error(err)
return nil, err
}
p := &grpcPlugin{
conn: conn,
log: log,
}
if conn != nil {
p.client = proto.NewResolverClient(conn)
conn: conn,
client: proto.NewResolverClient(conn),
log: log,
}
return p, nil
}