mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Reuse buffer for constructing request.
This commit is contained in:
12
pipeline.go
12
pipeline.go
@ -46,17 +46,7 @@ func (c *PipelineClient) RunQueued() ([]Req, error) {
|
||||
}
|
||||
|
||||
func (c *PipelineClient) RunReqs(reqs []Req, conn *Conn) error {
|
||||
var multiReq []byte
|
||||
if len(reqs) == 1 {
|
||||
multiReq = reqs[0].Req()
|
||||
} else {
|
||||
multiReq = make([]byte, 0, 1024)
|
||||
for _, req := range reqs {
|
||||
multiReq = append(multiReq, req.Req()...)
|
||||
}
|
||||
}
|
||||
|
||||
err := c.WriteReq(multiReq, conn)
|
||||
err := c.WriteReq(conn, reqs...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user