mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
fix race
This commit is contained in:
4
TODO.md
4
TODO.md
@@ -5,8 +5,8 @@
|
||||
- [ ] Pedantic state
|
||||
- [ ] brew, apt-get, rpm, chocately (windows)
|
||||
- [ ] Dynamic socket buffer sizes
|
||||
- [ ] Switch to 1.4 and use maps vs hashmaps in sublist
|
||||
- [ ] Sublist better at high concurrency
|
||||
- [ ] Switch to 1.4/1.5 and use maps vs hashmaps in sublist
|
||||
- [ ] Sublist better at high concurrency, cache uses writelock currently
|
||||
- [ ] Buffer pools/sync pools?
|
||||
- [ ] IOVec pools and writev for high fanout?
|
||||
- [ ] Add ability to reload config on signal
|
||||
|
||||
@@ -53,7 +53,15 @@ func (d ByPending) Swap(i, j int) {
|
||||
d[i], d[j] = d[j], d[i]
|
||||
}
|
||||
func (d ByPending) Less(i, j int) bool {
|
||||
return d[i].Val.bw.Buffered() < d[j].Val.bw.Buffered()
|
||||
client := d[i].Val
|
||||
client.mu.Lock()
|
||||
bwi := client.bw.Buffered()
|
||||
client.mu.Unlock()
|
||||
client = d[j].Val
|
||||
client.mu.Lock()
|
||||
bwj := client.bw.Buffered()
|
||||
client.mu.Unlock()
|
||||
return bwi < bwj
|
||||
}
|
||||
|
||||
type ByOutMsgs []Pair
|
||||
|
||||
Reference in New Issue
Block a user