// Next fetch next event, nil for timeout, or JSON unmarshal error
Next fetch next event, nil for timeout, or JSON unmarshal error
// Next fetch next event nil for timeout or JSON unmarshal error
func (b *Redis) Next() (r xlog.RecordConvertible, err error) {
	var ret []string
	if ret, err = b.Client.BLPop(time.Second*3, b.Key).Result(); err != nil {
		if err == redis.Nil {
			err = nil
		}
		return
	}
	if len(ret) == 0 {
		return
	}
	raw := ret[len(ret)-1]
	var be BeatEvent
	if err = json.Unmarshal([]byte(raw), &be); err != nil {
		err = nil
		return
	}
	r = be
	return
}
func ( b * Redis ) Next ( ) ( r xlog . RecordConvertible , err error ) { var ret [ ] string if ret , err = b . Client . BLPop ( time . Second * 3 , b . Key ) . Result ( ) ; err != nil { if err == redis . Nil { err = nil } return } if len ( ret ) == 0 { return } raw := ret [ len ( ret ) - 1 ] var be BeatEvent if err = json . Unmarshal ( [ ] byte ( raw ) , & be ) ; err != nil { err = nil return } r = be return }
Next fetch next event, nil for timeout, or JSON unmarshal error
Next fetch next event nil for timeout or JSON unmarshal error
// BLPOP // redis.Nil should be ignored // length == 0 for timeout, should be ignored // length 1 for single key, 2 for multiple key, so ret[-1] should be fine // unmarshal json // JSON unmarshal error should be ignored