Danger here: If it is a Raft write command, Raft will perform command rollback => stuck Raft. If it is a Raft read command, then Raft will not be able to roll back the queue consumption log, and dirty data in the queue will appear. func cmdBLPOP(m uhaha.Machine, args []string) (interface{}, error) {
(argsOrigin []string)
| 446 | // } |
| 447 | |
| 448 | func lParseBPopArgs(argsOrigin []string) (keys [][]byte, timeout time.Duration, err error) { |
| 449 | if len(argsOrigin) < 3 { |
| 450 | err = uhaha.ErrWrongNumArgs |
| 451 | return |
| 452 | } |
| 453 | |
| 454 | args := make([][]byte, len(argsOrigin)-1) |
| 455 | for i := 1; i < len(argsOrigin); i++ { |
| 456 | args[i-1] = []byte(argsOrigin[i]) |
| 457 | } |
| 458 | var t float64 |
| 459 | if t, err = strconv.ParseFloat(hack.String(args[len(args)-1]), 64); err != nil { |
| 460 | return |
| 461 | } |
| 462 | |
| 463 | timeout = time.Duration(t * float64(time.Second)) |
| 464 | |
| 465 | keys = args[0 : len(args)-1] |
| 466 | return |
| 467 | } |