Skip to content

Commit

Permalink
fix: refraining from using gopool for long-running tasks (bnb-chain#20)
Browse files Browse the repository at this point in the history
Co-authored-by: Welkin <welkin.b@nodereal.com>
  • Loading branch information
welkin22 and Welkin authored Jan 5, 2024
1 parent 9d35ab5 commit e13d451
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions eth/bloombits.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"time"

"github.com/ethereum/go-ethereum/common/bitutil"
"github.com/ethereum/go-ethereum/common/gopool"
"github.com/ethereum/go-ethereum/core/rawdb"
)

Expand All @@ -46,7 +45,7 @@ const (
// retrievals from possibly a range of filters and serving the data to satisfy.
func (eth *Ethereum) startBloomHandlers(sectionSize uint64) {
for i := 0; i < bloomServiceThreads; i++ {
gopool.Submit(func() {
go func() {
for {
select {
case <-eth.closeBloomHandler:
Expand All @@ -70,6 +69,6 @@ func (eth *Ethereum) startBloomHandlers(sectionSize uint64) {
request <- task
}
}
})
}()
}
}
4 changes: 2 additions & 2 deletions p2p/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ func newDialScheduler(config dialConfig, it enode.Iterator, setupFunc dialSetupF
d.lastStatsLog = d.clock.Now()
d.ctx, d.cancel = context.WithCancel(context.Background())
d.wg.Add(2)
gopool.Submit(func() { d.readNodes(it) })
gopool.Submit(func() { d.loop(it) })
go func() { d.readNodes(it) }()
go func() { d.loop(it) }()
return d
}

Expand Down

0 comments on commit e13d451

Please sign in to comment.