Skip to content

Commit b60693a

Browse files
fancy-rabbitspinlock
authored andcommitted
Skip the empty \r\n during redis-cli --pipe (#1514)
* skip the empty \r\n after redis-cli --pipe done sending data and before the ECHO * use len() to determine for PR #1514
1 parent 4803cff commit b60693a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pkg/proxy/redis/decoder.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ func (d *Decoder) decodeSingleLineMultiBulk() ([]*Resp, error) {
211211
if err != nil {
212212
return nil, err
213213
}
214+
if len(b) == 0 {
215+
return nil, nil
216+
}
214217
multi := make([]*Resp, 0, 8)
215218
for l, r := 0, 0; r <= len(b); r++ {
216219
if r == len(b) || b[r] == ' ' {

pkg/proxy/session.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ func (s *Session) loopReader(tasks *RequestChan, d *Router) (err error) {
164164
if err != nil {
165165
return err
166166
}
167+
if len(multi) == 0 {
168+
continue
169+
}
167170
s.incrOpTotal()
168171

169172
if tasks.Buffered() > maxPipelineLen {

0 commit comments

Comments
 (0)