提交 6a5bc4b8 作者: Brian Tiger Chow 提交者: Jeromy

fix(bs/n) remove unnecessary variable

to remove ambiguity

(before it was possible to loop over either topics or keys

by only keeping keys, there's no confusing about what to use for the
loop range

License: MIT
Signed-off-by: 's avatarBrian Tiger Chow <brian@perfmode.com>
上级 134929ac
......@@ -37,14 +37,14 @@ func (ps *impl) Shutdown() {
// is closed if the |ctx| times out or is cancelled, or after sending len(keys)
// blocks.
func (ps *impl) Subscribe(ctx context.Context, keys ...u.Key) <-chan *blocks.Block {
topics := toStrings(keys)
blocksCh := make(chan *blocks.Block, len(keys))
valuesCh := make(chan interface{}, len(keys))
ps.wrapped.AddSub(valuesCh, topics...)
ps.wrapped.AddSub(valuesCh, toStrings(keys)...)
go func() {
defer func() {
ps.wrapped.Unsub(valuesCh, topics...)
ps.wrapped.Unsub(valuesCh, toStrings(keys)...)
close(blocksCh)
}()
for _, _ = range keys {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论