fix hanging goroutine
This commit is contained in:
@ -119,7 +119,12 @@ func (signalingServer SignalingServer) handleRedisPubSub(ctx context.Context, na
|
||||
}
|
||||
|
||||
ch := pubsub.Channel()
|
||||
for msg := range ch {
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
case msg := <-ch:
|
||||
|
||||
switch msg.Channel {
|
||||
case signalingServer.redisKeyPrefix + ":" + room + ":discover":
|
||||
if err := stream.Send(&proto.SignalingMessage{
|
||||
@ -175,6 +180,7 @@ func (signalingServer SignalingServer) handleRedisPubSub(ctx context.Context, na
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user