Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tapfreighter/chain_porter.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ func (p *ChainPorter) Start() error {

// Start the main chain porter goroutine.
p.Wg.Add(1)
go p.mainEventLoop()
go func() {
defer p.Wg.Done()
p.mainEventLoop()
}()

startErr = p.resumePendingParcels()
})
Expand Down Expand Up @@ -311,8 +314,6 @@ func (p *ChainPorter) QueryParcels(ctx context.Context,
// requests, and attempt to complete a transfer. A response is sent back to the
// caller if a transfer can be completed. Otherwise, an error is returned.
func (p *ChainPorter) mainEventLoop() {
defer p.Wg.Done()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a NOTE comment to this method that it MUST be run as a goroutine.
Normally, the defer p.Wg.Done() at the start of a method indicates this to someone reading the code.


for {
select {
case outboundParcel := <-p.outboundParcels:
Expand Down