From cb17bbc191bf6fdbddbebf9575307b5d9ec7eb75 Mon Sep 17 00:00:00 2001 From: Nikita Neznaemov Date: Wed, 4 Oct 2023 17:01:03 +0300 Subject: [PATCH] separate-observer-parsing-v2 --- observer/block_peer_concurrently_parse.go | 3 +++ observer/block_peer_parse.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/observer/block_peer_concurrently_parse.go b/observer/block_peer_concurrently_parse.go index 0870841..7bdd72f 100644 --- a/observer/block_peer_concurrently_parse.go +++ b/observer/block_peer_concurrently_parse.go @@ -24,6 +24,9 @@ func (pbp *ParsedBlockPeer) ObserveByChannels(ctx context.Context) (*ParsedBlock pbp.mu.Lock() defer pbp.mu.Unlock() + // need to start default block peer observing + _, _ = pbp.blockPeer.ObserveByChannels(ctx) + blocksByChannels := &ParsedBlocksByChannels{ channels: make(chan *ChannelParsedBlocks), } diff --git a/observer/block_peer_parse.go b/observer/block_peer_parse.go index 465e3d5..182f31b 100644 --- a/observer/block_peer_parse.go +++ b/observer/block_peer_parse.go @@ -67,6 +67,9 @@ func (pbp *ParsedBlockPeer) Observe(ctx context.Context) (<-chan *ParsedBlock, e return pbp.blocks, nil } + // need to start default block peer observing + _, _ = pbp.blockPeer.Observe(ctx) + // ctxObserve using for nested control process without stopped primary context ctxObserve, cancel := context.WithCancel(ctx) pbp.cancelObserve = cancel