Merge pull request #1757 from cfromknecht/parallel-link-shutdown
htlcswitch/switch: shutdown links concurrently
This commit is contained in:
1 file changed
+9
-1
@@ -1401,9 +1401,17 @@ func (s *Switch) htlcForwarder() {
|
|||||||
|
|
||||||
// Now that all pending and live links have been removed from
|
// Now that all pending and live links have been removed from
|
||||||
// the forwarding indexes, stop each one before shutting down.
|
// the forwarding indexes, stop each one before shutting down.
|
||||||
|
// We'll shut them down in parallel to make exiting as fast as
|
||||||
|
// possible.
|
||||||
|
var wg sync.WaitGroup
|
||||||
for _, link := range linksToStop {
|
for _, link := range linksToStop {
|
||||||
link.Stop()
|
wg.Add(1)
|
||||||
|
go func(l ChannelLink) {
|
||||||
|
defer wg.Done()
|
||||||
|
l.Stop()
|
||||||
|
}(link)
|
||||||
}
|
}
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
// Before we exit fully, we'll attempt to flush out any
|
// Before we exit fully, we'll attempt to flush out any
|
||||||
// forwarding events that may still be lingering since the last
|
// forwarding events that may still be lingering since the last
|
||||||
|
|||||||
Reference in new issue
Block a user