mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 08:41:42 +02:00
fn/ContextGuard: clear store of cancel funcs
If ContextGuard lives for some time after Quit method is called, the map won't be collected by GC. Optimization.
This commit is contained in:
@@ -51,6 +51,10 @@ func (g *ContextGuard) Quit() {
|
||||
cancel()
|
||||
}
|
||||
|
||||
// Clear cancelFns. It is safe to use nil, because no write
|
||||
// operations to it can happen after g.quit is closed.
|
||||
g.cancelFns = nil
|
||||
|
||||
close(g.quit)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user