Skip to content

Commit

Permalink
separate-observer-parsing-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Neznaemov committed Oct 4, 2023
1 parent aa789df commit cb17bbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions observer/block_peer_concurrently_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
3 changes: 3 additions & 0 deletions observer/block_peer_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cb17bbc

Please sign in to comment.