Terry-Mao / goim

goim
https://goim.io/
MIT License
7.21k stars 1.78k forks source link

channal.push的时候signal chan在阻塞的情况下走default那不是会丢消息? #240

Closed weisd closed 5 years ago

weisd commented 5 years ago

https://github.com/Terry-Mao/goim/blob/35e3a4830973a59638fd44314bda70989362d9ae/internal/comet/channel.go#L87

// Push server push message.
func (c *Channel) Push(p *grpc.Proto) (err error) {
    select {
    case c.signal <- p:
    default:
    }
    return
}

如题

tonybase commented 5 years ago

要是需要确保消息也可以阻塞下,不过对于消费量大或者服务端流量打满丢包时有点风险,也可以配置buff proto大小尽量避免