refactor(pico): clear connections in one time to improve perf
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
0e506585e5
commit
1417d1aab9
1 changed files with 2 additions and 2 deletions
|
|
@ -156,10 +156,10 @@ func (c *PicoChannel) takeAllConnections() []*picoConn {
|
||||||
defer c.connsMu.Unlock()
|
defer c.connsMu.Unlock()
|
||||||
|
|
||||||
all := make([]*picoConn, 0, len(c.connections))
|
all := make([]*picoConn, 0, len(c.connections))
|
||||||
for connID, pc := range c.connections {
|
for _, pc := range c.connections {
|
||||||
all = append(all, pc)
|
all = append(all, pc)
|
||||||
delete(c.connections, connID)
|
|
||||||
}
|
}
|
||||||
|
clear(c.connections)
|
||||||
clear(c.sessionConnections)
|
clear(c.sessionConnections)
|
||||||
|
|
||||||
return all
|
return all
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue