From ee8d50addd98187ca1c11de3246a2476463eb671 Mon Sep 17 00:00:00 2001 From: Oliver Tonnhofer Date: Wed, 13 Nov 2013 13:20:37 +0100 Subject: [PATCH] reset cached bunches when flushing DeltaCoordsCache --- cache/delta.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cache/delta.go b/cache/delta.go index e7fd3f0..901d576 100644 --- a/cache/delta.go +++ b/cache/delta.go @@ -124,11 +124,18 @@ func (self *DeltaCoordsCache) SetLinearImport(v bool) { } func (self *DeltaCoordsCache) Flush() { + self.mu.Lock() + defer self.mu.Unlock() for bunchId, bunch := range self.table { if bunch.needsWrite { self.putCoordsPacked(bunchId, bunch.coords) } } + + self.lruList.Init() + for k, _ := range self.table { + delete(self.table, k) + } } func (self *DeltaCoordsCache) Close() { self.Flush()