Skip to content

Commit

Permalink
fix race
Browse files Browse the repository at this point in the history
  • Loading branch information
derekcollison committed Aug 23, 2015
1 parent e8d736e commit ffa21f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion server/monitor_sort_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ffa21f3

Please sign in to comment.