Skip to content

Commit 68f7b23

Browse files
committed
refactoring heapManager: no need to for extra goroutine
heapManager.run already runs in its own goroutine so spawning new goroutine in defer is overhead.
1 parent 641f03b commit 68f7b23

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

heap_manager.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@ func (m heapManager) run(shutdownNotifier chan<- interface{}) {
4343
defer func() {
4444
close(done)
4545
if shutdownNotifier != nil {
46-
go func() {
47-
select {
48-
case shutdownNotifier <- []*Bar(bHeap):
49-
case <-time.After(time.Second):
50-
}
51-
}()
46+
select {
47+
case shutdownNotifier <- []*Bar(bHeap):
48+
case <-time.After(time.Second):
49+
}
5250
}
5351
}()
5452

0 commit comments

Comments
 (0)