Cache connection properties in the pool
This is a quick attempt to improve connection startup time by caching the properties that are loaded when a connection is ready in the pool, so that further connections don't incur this cost. I'm not entirely convinced by the interface here, perhaps these 3 items could live in their own type and that be passed around for clearer code, but the idea works well.
This commit is contained in:
@@ -1576,10 +1576,10 @@ func encodeIPNet(w *WriteBuf, oid Oid, value net.IPNet) error {
|
||||
switch len(value.IP) {
|
||||
case net.IPv4len:
|
||||
size = 8
|
||||
family = w.conn.pgsql_af_inet
|
||||
family = *w.conn.pgsql_af_inet
|
||||
case net.IPv6len:
|
||||
size = 20
|
||||
family = w.conn.pgsql_af_inet6
|
||||
family = *w.conn.pgsql_af_inet6
|
||||
default:
|
||||
return fmt.Errorf("Unexpected IP length: %v", len(value.IP))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user