Skip to content

Commit

Permalink
Respond with null array to consumers
Browse files Browse the repository at this point in the history
BLPOP should return what the Redis protocol calls a "null array", that
is "*-1\r\n". Previously, we returned a null string, "$-1\r\n". While
this does not have any concrete effects, it's just semantically correct
to follow the Redis protocol where we can.

See https://redis.io/topics/protocol (RESP Arrays) and
https://redis.io/commands/blpop
  • Loading branch information
agis committed May 20, 2019
1 parent 686af22 commit adf3650
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ func (s *Server) Handle(ctx context.Context, conn net.Conn) {
writeErr = writer.WriteError("CONS Server shutdown")
break ConsLoop
case <-ticker.C:
writeErr = writer.WriteBulk(nil)
// WriteBulkStrings() is the only method
// that returns what the Redis Protocol
// calls a "null array" (i.e. "*-1\r\n")
//
// see https://github.com/secmask/go-redisproto/issues/4
writeErr = writer.WriteBulkStrings(nil)
break ConsLoop
default:
ev, err := cons.Poll(100)
Expand Down

0 comments on commit adf3650

Please sign in to comment.