关闭。这个问题需要details or clarity .它目前不接受答案。
想改进这个问题?通过 editing this post 添加详细信息并澄清问题.
1年前关闭。
Improve this question
在 golang 中从一个 goroutine 我将消息发布到缓冲 channel 。但是我的 reader goroutine 的处理速度可能有点慢,并且从 channel 中读取的任何内容都可能不会更快。
因此,为了阻止 channel 缓冲区被填满,我不希望在缓冲 channel 中再次发布相同的数据。有没有办法做到这一点?
最佳答案
Is there a way to do that?
不。
channel (缓冲或不缓冲)是不透明的,除了从它们发送或接收之外,您什么也做不了,它们绝对不提供进一步的逻辑。
关于Golang 缓冲 channel : Ignore/suppress sending repeated values,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62190538/