Commit 6a5bc4b8 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by 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: default avatarBrian Tiger Chow <brian@perfmode.com>
parent 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 is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment