修复实时查看
This commit is contained in:
parent
9a234f50fb
commit
f53af2c097
|
|
@ -233,6 +233,7 @@ func subscribeAndHandleMessages(ws *websocket.Conn, device_id int) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
pubsub := worker.RedisClient.Subscribe(ctx, strconv.Itoa(device_id)+"_frames_msgs")
|
pubsub := worker.RedisClient.Subscribe(ctx, strconv.Itoa(device_id)+"_frames_msgs")
|
||||||
defer pubsub.Close()
|
defer pubsub.Close()
|
||||||
|
defer ws.Close()
|
||||||
ch := pubsub.Channel()
|
ch := pubsub.Channel()
|
||||||
var check_cnt int
|
var check_cnt int
|
||||||
for msg := range ch {
|
for msg := range ch {
|
||||||
|
|
@ -261,10 +262,9 @@ func subscribeAndHandleMessages(ws *websocket.Conn, device_id int) {
|
||||||
clientsMux.Lock()
|
clientsMux.Lock()
|
||||||
clients[ws] = false
|
clients[ws] = false
|
||||||
clientsMux.Unlock()
|
clientsMux.Unlock()
|
||||||
ws.Close()
|
fmt.Println("send message to client err:", err2)
|
||||||
worker.SetRedisWithExpire(strconv.Itoa(device_id)+"_is_play", "0", time.Minute*5)
|
worker.SetRedisWithExpire(strconv.Itoa(device_id)+"_is_play", "0", time.Minute*5)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
time.Sleep(time.Millisecond * 200)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue