mirror of
https://github.com/redis/go-redis.git
synced 2025-07-26 19:21:03 +03:00
Fix monitor on go 1.19 (#2908)
* Fix monitor on go 1.19 * Remove exmaple tests when go 1.19 * Fix typo * Fix typo * Skip exmaple test * Skip exmaple test * Guard Peek call with mutex for thread safety
This commit is contained in:
@ -5454,9 +5454,12 @@ func (cmd *MonitorCmd) readMonitor(rd *proto.Reader, cancel context.CancelFunc)
|
||||
for {
|
||||
cmd.mu.Lock()
|
||||
st := cmd.status
|
||||
pk, _ := rd.Peek(1)
|
||||
cmd.mu.Unlock()
|
||||
if pk, _ := rd.Peek(1); len(pk) != 0 && st == monitorStatusStart {
|
||||
if len(pk) != 0 && st == monitorStatusStart {
|
||||
cmd.mu.Lock()
|
||||
line, err := rd.ReadString()
|
||||
cmd.mu.Unlock()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user