txPipelineReadQueued reads queued replies from the Redis server. It returns an error if the server returns an error or if the number of replies does not match the number of commands.
(ctx context.Context, cn *pool.Conn, rd *proto.Reader, statusCmd *StatusCmd, cmds []Cmder)
| 1288 | // txPipelineReadQueued reads queued replies from the Redis server. |
| 1289 | // It returns an error if the server returns an error or if the number of replies does not match the number of commands. |
| 1290 | func (c *baseClient) txPipelineReadQueued(ctx context.Context, cn *pool.Conn, rd *proto.Reader, statusCmd *StatusCmd, cmds []Cmder) error { |
| 1291 | // To be sure there are no buffered push notifications, we process them before reading the reply |
| 1292 | if err := c.processPendingPushNotificationWithReader(ctx, cn, rd); err != nil { |
| 1293 | internal.Logger.Printf(ctx, "push: error processing pending notifications before reading reply: %v", err) |
| 1294 | } |
| 1295 | // Parse +OK. |
| 1296 | if err := statusCmd.readReply(rd); err != nil { |
| 1297 | return err |
| 1298 | } |
| 1299 | |
| 1300 | // Parse +QUEUED. |
| 1301 | for _, cmd := range cmds { |
| 1302 | // To be sure there are no buffered push notifications, we process them before reading the reply |
| 1303 | if err := c.processPendingPushNotificationWithReader(ctx, cn, rd); err != nil { |
| 1304 | internal.Logger.Printf(ctx, "push: error processing pending notifications before reading reply: %v", err) |
| 1305 | } |
| 1306 | if err := statusCmd.readReply(rd); err != nil { |
| 1307 | cmd.SetErr(err) |
| 1308 | if !isRedisError(err) { |
| 1309 | return err |
| 1310 | } |
| 1311 | } |
| 1312 | } |
| 1313 | |
| 1314 | // To be sure there are no buffered push notifications, we process them before reading the reply |
| 1315 | if err := c.processPendingPushNotificationWithReader(ctx, cn, rd); err != nil { |
| 1316 | internal.Logger.Printf(ctx, "push: error processing pending notifications before reading reply: %v", err) |
| 1317 | } |
| 1318 | // Parse number of replies. |
| 1319 | line, err := rd.ReadLine() |
| 1320 | if err != nil { |
| 1321 | if err == Nil { |
| 1322 | err = TxFailedErr |
| 1323 | } |
| 1324 | return err |
| 1325 | } |
| 1326 | |
| 1327 | if line[0] != proto.RespArray { |
| 1328 | return fmt.Errorf("redis: expected '*', but got line %q", line) |
| 1329 | } |
| 1330 | |
| 1331 | return nil |
| 1332 | } |
| 1333 | |
| 1334 | //------------------------------------------------------------------------------ |
| 1335 |
no test coverage detected