Skip to content
Snippets Groups Projects
Commit 9b9aa684 authored by Manish R Jain's avatar Manish R Jain
Browse files

Merge branch 'master' into dmuts

parents 033acc99 197f6d23
No related branches found
No related tags found
No related merge requests found
...@@ -101,22 +101,18 @@ func gentlyMerge(ms runtime.MemStats) { ...@@ -101,22 +101,18 @@ func gentlyMerge(ms runtime.MemStats) {
ctr := NewCounters() ctr := NewCounters()
defer ctr.ticker.Stop() defer ctr.ticker.Stop()
// Pick 400 keys from dirty map. // Pick 1% of the dirty map or 400 keys, whichever is higher.
pick := int(float64(dirtymap.Size()) * 0.01)
if pick < 400 {
pick = 400
}
var hs []gotomic.Hashable var hs []gotomic.Hashable
dirtymap.Each(func(k gotomic.Hashable, v gotomic.Thing) bool { dirtymap.Each(func(k gotomic.Hashable, v gotomic.Thing) bool {
hs = append(hs, k) hs = append(hs, k)
return len(hs) >= 400 return len(hs) >= pick
}) })
idx := 0 for _, hid := range hs {
t := time.NewTicker(10 * time.Millisecond)
defer t.Stop()
for _ = range t.C {
if idx >= len(hs) {
break
}
hid := hs[idx]
idx += 1
dirtymap.Delete(hid) dirtymap.Delete(hid)
ret, ok := lhmap.Get(hid) ret, ok := lhmap.Get(hid)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment