mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Speed up connections by sending SetInfo via a pipeline (#2880)
* Send Client SetInfo via pipe * Fix ACL test * Add client set info to acl command rules
This commit is contained in:
19
redis.go
19
redis.go
@ -312,16 +312,7 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
|
||||
// difficult to rely on error strings to determine all results.
|
||||
return err
|
||||
}
|
||||
if !c.opt.DisableIndentity {
|
||||
libName := ""
|
||||
libVer := Version()
|
||||
|
||||
if c.opt.IdentitySuffix != "" {
|
||||
libName = c.opt.IdentitySuffix
|
||||
}
|
||||
conn.ClientSetInfo(ctx, WithLibraryName(libName))
|
||||
conn.ClientSetInfo(ctx, WithLibraryVersion(libVer))
|
||||
}
|
||||
_, err := conn.Pipelined(ctx, func(pipe Pipeliner) error {
|
||||
if !auth && password != "" {
|
||||
if username != "" {
|
||||
@ -343,6 +334,16 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
|
||||
pipe.ClientSetName(ctx, c.opt.ClientName)
|
||||
}
|
||||
|
||||
if !c.opt.DisableIndentity {
|
||||
libName := ""
|
||||
libVer := Version()
|
||||
if c.opt.IdentitySuffix != "" {
|
||||
libName = c.opt.IdentitySuffix
|
||||
}
|
||||
pipe.ClientSetInfo(ctx, WithLibraryName(libName))
|
||||
pipe.ClientSetInfo(ctx, WithLibraryVersion(libVer))
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user