lntest: ensure we always cancel active streaming notifications
This commit is contained in:
3 files changed
+11
-3
No files matched your search
+4
-2
@@ -639,9 +639,9 @@ func (hn *HarnessNode) lightningNetworkWatcher() {
|
||||
go func() {
|
||||
defer hn.wg.Done()
|
||||
|
||||
ctxb := context.Background()
|
||||
req := &lnrpc.GraphTopologySubscription{}
|
||||
topologyClient, err := hn.SubscribeChannelGraph(ctxb, req)
|
||||
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||
topologyClient, err := hn.SubscribeChannelGraph(ctx, req)
|
||||
if err != nil {
|
||||
// We panic here in case of an error as failure to
|
||||
// create the topology client will cause all subsequent
|
||||
@@ -650,6 +650,8 @@ func (hn *HarnessNode) lightningNetworkWatcher() {
|
||||
"client: %v", err))
|
||||
}
|
||||
|
||||
defer cancelFunc()
|
||||
|
||||
for {
|
||||
update, err := topologyClient.Recv()
|
||||
if err == io.EOF {
|
||||
|
||||
Reference in new issue
Block a user